IsPlayerInVehicle help.
#1

Hi making my /startjob command using ZCMD. I don't get an error ingame and i made sure i have return 1; after each section. So here is the command:
pawn Код:
CMD:startjob(playerid, params[])
{
    if(IsPlayerInVehicle(playerid, 414))
    {
        if(pJob[playerid] == TRUCKER)
        {
            SendClientMessage(playerid, COLOR_WHITE, ".:: You have started work ::.");
            SendClientMessage(playerid, COLOR_GREEN, ".: Enter the checkpoint to start :.");
            SetPlayerCheckpoint(playerid, -1580.2484,74.9872,3.5547, 3.0);
            trucking[playerid] = 1;
            return 1;
        }
     else SendClientMessage(playerid, COLOR_SYNTAX, ".:: You must be a trucker / in a truck to work in this vehicle ::.");
     return 1;
    }
    return 1;
}
Reply
#2

what error? and I would use GetPlayerVehicleId or whatever it was.
Reply
#3

I dont get any error at all not a compile error or a ingame error message, i remember that function but i dont suppose that you could use it in this example because its my first time reworking on my script for a few days now and i forget whether or not i tried it. I believe i did but i think it still did not work. If you need any more of the script like what happens after the user uses that command, just ask though i think its unlikely that that would stop the command from working alltogether.
Reply
#4

A Little Mistake here , replace :

pawn Код:
IsPlayerInVehicle
For :

pawn Код:
if(!IsPlayerInAnyVehicle(playerid))
Getting :

pawn Код:
CMD:startjob(playerid, params[])
{
    if(!IsPlayerInAnyVehicle(playerid, 414))
    {
        if(pJob[playerid] == TRUCKER)
        {
            SendClientMessage(playerid, COLOR_WHITE, ".:: You have started work ::.");
            SendClientMessage(playerid, COLOR_GREEN, ".: Enter the checkpoint to start :.");
            SetPlayerCheckpoint(playerid, -1580.2484,74.9872,3.5547, 3.0);
            trucking[playerid] = 1;
            return 1;
        }
     else SendClientMessage(playerid, COLOR_SYNTAX, ".:: You must be a trucker / in a truck to work in this vehicle ::.");
     return 1;
    }
    return 1;
}
Reply
#5

Quote:
Originally Posted by .FuneraL.
Посмотреть сообщение
A Little Mistake here , replace :

pawn Код:
IsPlayerInVehicle
For :

pawn Код:
if(!IsPlayerInAnyVehicle(playerid))
Getting :

pawn Код:
CMD:startjob(playerid, params[])
{
    if(!IsPlayerInAnyVehicle(playerid, 414))
    {
        if(pJob[playerid] == TRUCKER)
        {
            SendClientMessage(playerid, COLOR_WHITE, ".:: You have started work ::.");
            SendClientMessage(playerid, COLOR_GREEN, ".: Enter the checkpoint to start :.");
            SetPlayerCheckpoint(playerid, -1580.2484,74.9872,3.5547, 3.0);
            trucking[playerid] = 1;
            return 1;
        }
     else SendClientMessage(playerid, COLOR_SYNTAX, ".:: You must be a trucker / in a truck to work in this vehicle ::.");
     return 1;
    }
    return 1;
}
Ill +rep if it worked
Reply
#6

ok so it didnt work but i did get the error message outside of my car. here is what happens after you enter the checkpoint which is made maybe its that:
pawn Код:
public OnPlayerEnterCheckpoint(playerid)
{
    if(trucking[playerid] == 1)
    {
        DisablePlayerCheckpoint(playerid);
        trucking[playerid] = 2;
        SendClientMessage(playerid, COLOR_WHITE, "You have loaded your goods, make your way to the store!");
        SetPlayerCheckpoint(playerid, 1374.1812,-1890.8579,13.4906, 3.0);
        return 1;
    }
    if(trucking[playerid] == 2)
    {
        DisablePlayerCheckpoint(playerid);
        trucking[playerid] = 3;
        SendClientMessage(playerid, COLOR_WHITE, "You have successfully delivered the goods, make your way back!");
        SetPlayerCheckpoint(playerid, -1552.3555,119.2117,3.5547, 3.0);
        return 1;
    }
    if(trucking[playerid] == 3)
    {
        DisablePlayerCheckpoint(playerid);
        trucking[playerid] = 0;
        SendClientMessage(playerid, COLOR_WHITE, "You have successfully completed the mission!");
        GivePlayerMoney(playerid, 5000);
        return 1;
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)