IsPlayerInVehicle help. - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: IsPlayerInVehicle help. (
/showthread.php?tid=327334)
IsPlayerInVehicle help. -
NewerthRoleplay - 20.03.2012
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;
}
Re: IsPlayerInVehicle help. -
GNGification - 20.03.2012
what error? and I would use GetPlayerVehicleId or whatever it was.
Re: IsPlayerInVehicle help. -
NewerthRoleplay - 20.03.2012
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.
Re: IsPlayerInVehicle help. -
.FuneraL. - 20.03.2012
A Little Mistake here , replace :
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;
}
Re: IsPlayerInVehicle help. -
NewerthRoleplay - 20.03.2012
Quote:
Originally Posted by .FuneraL.
A Little Mistake here , replace :
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
Re: IsPlayerInVehicle help. -
NewerthRoleplay - 20.03.2012
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;
}