Requesting help with OnPlayerEnterVehicle
#1

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(playeridvehicleidispassenger)
{
    switch(
vehicleid)
    {
        case 
574:
        {
        
SendClientMessage(playerid, -1"You are now street sweeping to earn money. Drive around to get your money");
        
SetTimer("Sweeping"10000false);
        }
    }
    return 
1;
}
forward Sweeping(playerid);
public 
Sweeping(playerid)
{
new 
string[128];
new 
rand 200 random(500);
GivePlayerMoney(playeridrand);
format(stringsizeof(string), "You have received $%d for your street sweeping job"rand);
SendClientMessage(playerid, -1string);
return 
1;

Reply
#2

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.
Reply
#3

Still the same problem.. No messages sent, No money too.
Reply
#4

Do you teleport inside the vehicle instead of entering with F or enter?
Otherwise you should use OnPlayerStateChange
Reply
#5

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(playeridparams[])
{
if(
IsPlayerInVehicle(playerid574))
{
SendClientMessage(playerid, -1"You are in a sweeper");
}
return 
1;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)