SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 05/02/2013, 03:59 PM   #1
Magic_Time
Huge Clucker
 
Join Date: Aug 2012
Posts: 237
Reputation: 10
Default Requesting help with OnPlayerEnterVehicle

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;

Magic_Time is offline   Reply With Quote
Old 05/02/2013, 04:01 PM   #2
Pangea
Big Clucker
 
Join Date: Feb 2011
Posts: 71
Reputation: 9
Default Re: Requesting help with OnPlayerEnterVehicle

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.
Pangea is offline   Reply With Quote
Old 05/02/2013, 04:05 PM   #3
Magic_Time
Huge Clucker
 
Join Date: Aug 2012
Posts: 237
Reputation: 10
Default Re: Requesting help with OnPlayerEnterVehicle

Still the same problem.. No messages sent, No money too.
Magic_Time is offline   Reply With Quote
Old 05/02/2013, 04:13 PM   #4
Pangea
Big Clucker
 
Join Date: Feb 2011
Posts: 71
Reputation: 9
Default Re: Requesting help with OnPlayerEnterVehicle

Do you teleport inside the vehicle instead of entering with F or enter?
Otherwise you should use OnPlayerStateChange
Pangea is offline   Reply With Quote
Old 05/02/2013, 04:19 PM   #5
Magic_Time
Huge Clucker
 
Join Date: Aug 2012
Posts: 237
Reputation: 10
Default Re: Requesting help with OnPlayerEnterVehicle

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;

Magic_Time is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
OnPlayerEnterVehicle dannyk0ed Scripting Help 6 05/04/2012 09:55 PM
OnPlayerEnterVehicle HeadoN Scripting Help 1 11/03/2012 09:29 AM
OnPlayerEnterVehicle [+Rep] Twinki1993 Scripting Help 12 08/02/2012 05:00 PM
OnPlayerEnterVehicle Hobod Help Archive 6 21/05/2011 05:13 PM
OnPlayerEnterVehicle TheNotorius Help Archive 3 09/04/2010 12:16 PM


All times are GMT. The time now is 03:44 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.