Requesting help with OnPlayerEnterVehicle - 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: Requesting help with OnPlayerEnterVehicle (
/showthread.php?tid=413486)
Requesting help with OnPlayerEnterVehicle -
Magic_Time - 05.02.2013
Hi, I want, when a player enters in vehicle "574"(Sweeper). He'll start the job.
The problem is that no message is sent. Also the money is not sent to the player here is the code:
PHP Code:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
switch(vehicleid)
{
case 574:
{
SendClientMessage(playerid, -1, "You are now street sweeping to earn money. Drive around to get your money");
SetTimer("Sweeping", 10000, false);
}
}
return 1;
}
forward Sweeping(playerid);
public Sweeping(playerid)
{
new string[128];
new rand = 200 + random(500);
GivePlayerMoney(playerid, rand);
format(string, sizeof(string), "You have received $%d for your street sweeping job", rand);
SendClientMessage(playerid, -1, string);
return 1;
}
Re: Requesting help with OnPlayerEnterVehicle -
Pangea - 05.02.2013
SetTimer does not support parameters.
Change the SetTimer line with this:
pawn Code:
SetTimerEx("Sweeping", 10000, false, "i", playerid);
SetTimerEx is the same, but SetTimerEx does support parameters.
Re: Requesting help with OnPlayerEnterVehicle -
Magic_Time - 05.02.2013
Still the same problem.. No messages sent, No money too.
Re: Requesting help with OnPlayerEnterVehicle -
Pangea - 05.02.2013
Do you teleport inside the vehicle instead of entering with F or enter?
Otherwise you should use OnPlayerStateChange
Re: Requesting help with OnPlayerEnterVehicle -
Magic_Time - 05.02.2013
I'm using [0.3x]..
I tried this command to check if the server is checking the vehicle 574.
And unfortunately it's not checking... This is the command I used.
PHP Code:
CMD:mycar(playerid, params[])
{
if(IsPlayerInVehicle(playerid, 574))
{
SendClientMessage(playerid, -1, "You are in a sweeper");
}
return 1;
}