Looking for input and feedback on my code

Recommended Posts

Hey, I am new to programming and have created few scripts. I don't really want to move forward until I know if what I do is bad form or if there will be any issues in the future if I implement more things as I do.

Any feedback is appreciated, be it positive or negative. 


Clientside of the job: https://pastebin.com/ab9Aeycm

Serverside of the job: https://pastebin.com/xAFm3e2L


Feel free to ask any question as well.



  • Like 1

Share this post

Link to post
Share on other sites
Posted (edited)

I've just checked your server-side really fast and what came to my mind was that the startjob-command was done inefficiently. I'd do it like this:

        public void CMD_StartJob(Client client)
            if (!client.HasData("ID"))
                client.SendChatMessage("~r~Please login.");
            if (!client.HasData("Civilian"))
            if (client.HasData("InColShape"))
                    client.SendChatMessage("~r~Get out of your vehicle.");
                Vehicle veh = NAPI.Vehicle.CreateVehicle(VehicleHash.Sanchez, new Vector3(client.Position.X, client.Position.Y + 10, client.Position.Z), 0, 255, 255);
                client.SetIntoVehicle(veh, -1);
                client.SendChatMessage("Started ~y~bikejob~w~. Drive to the next objective for your reward!");

Since client can't execute the command unless logged in, that should be the first thing to check. client.HasData("ID")

In most servers, clients aren't given any data at all until they login, so checking for "Civilian" or "InColShape" is inefficient, should it turn out later than the client is not even logged in. Also, no need to check for client.IsInVehicle unless the player is actually inside the ColShape, again - unefficient.

The rest will be up to someone else, I'm far to inexperienced to decide upon the different functions etc.

Edited by introzen

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    No registered users viewing this page.