Help with my job system. /jobstart not recognised
#9

No clue why no one noticed it yet, but here's your solution:

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER)
        {
        new vModel = GetVehicleModel(GetPlayerVehicleID(playerid));
        if (vModel== 403 && job[playerid] != 1 || vModel==514 && job[playerid] != 1)
            {
            RemovePlayerFromVehicle(playerid);
            SendClientMessage(playerid,0xAA3333AA,"You do not have the trucker job");
            }
        else if (vModel== 448 && job[playerid] != 2)
            {
            RemovePlayerFromVehicle(playerid);
            SendClientMessage(playerid,0xAA3333AA,"You do not have the pizza-boy job");
            }
        else if (vModel== 408 && job[playerid] != 3)
            {
            RemovePlayerFromVehicle(playerid);
            SendClientMessage(playerid,0xAA3333AA,"You do not have the trashmaster job");
            }
        }
    return 1;
}
You did "vModel== 403 || vModel==514 && job[playerid] != 1" but that won't work, as it will always say "You do not have the trucker job" when a player enters vehicle model 403, trucker or not.

Best regards,
Jesse

EDIT:
"The problem is, whenever I enter the Tanker (first trucker vehicle) the command does nothing and when I enter the Linerunner (second trucker vehicle) it actually ejects me saying "You do not have the trucker job", which is only supposed to come up when the player doesn't have the trucker job, obviously."
This will fix the 2nd problem, I don't think it'll fix the first problem but your command "/jobstart" looks fine.

EDIT 2:
I checked the "/jobstart" code to be sure, a good indentation is important so always make sure you do it well. This is what I made of it and I think it looks good:
pawn Код:
if(!strcmp("/jobstart", cmdtext, true, 9))
    {
    new JobvModel = GetVehicleModel(GetPlayerVehicleID(playerid));
    if(job[playerid] == 1)
        {
        if(JobvModel == 403 || JobvModel == 514)
            {
            truckerCP[playerid] = 1;
            SetPlayerCheckpoint(playerid, 2114.2888,-2092.0613,13.5544, 4.0);
            SendClientMessage(playerid, 0x33AA33AA, "You have succesfully started your trucker job. Head to the checkpoint to pick up your trailer.");
            }
        }
    }
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)