SA-MP Forums Archive
Error on PlayerStateChange - 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: Error on PlayerStateChange (/showthread.php?tid=546439)



Error on PlayerStateChange - FunnyBear - 15.11.2014

Hey,

I'm trying to add a system when a civilian enters an enforcement vehicle, their wanted level will go up by 2 and a message will come up. It adds two stars to their wanted level, I'm also trying to send a message to the player telling them their new wanted level. But I get this error:

Код:
(1899) : warning 202: number of arguments does not match definition
And here is line 1899,

pawn Код:
SendClientMessage(playerid, INFO, "[WANTED LEVEL] Wanted level %s - Stealing an Enforcement vehicle!", GetPlayerWantedLevel(playerid) + 2);
Could someone help me?

Thanks


Re: Error on PlayerStateChange - J0sh... - 15.11.2014

pawn Код:
format(string, sizeof(string), "[WANTED LEVEL] Wanted level %s - Stealing an Enforcement vehicle!", GetPlayerWantedLevel(playerid) + 2);
SendClientMessage(playerid, INFO, string);
I'm sure that's right.


Re: Error on PlayerStateChange - AlphaPac - 15.11.2014

pawn Код:
new string[128];
format(string, sizeof(string), "[WANTED LEVEL] Wanted level %s - Stealing an Enforcement vehicle!", GetPlayerWantedLevel(playerid) + 2);
SendClientMessage(playerid, INFO, string);



Re: Error on PlayerStateChange - FunnyBear - 15.11.2014

Quote:
Originally Posted by JamesCaptGeneral
Посмотреть сообщение
pawn Код:
format(string, sizeof(string), "[WANTED LEVEL] Wanted level %s - Stealing an Enforcement vehicle!", GetPlayerWantedLevel(playerid) + 2);
SendClientMessage(playerid, INFO, string);
I'm sure that's right.
No errors, but in game it comes up as,

Код:
 Wanted level unday - Stealing an Enforcement vehicle!
Unday?


Re: Error on PlayerStateChange - Glossy42O - 15.11.2014

PHP код:
SendClientMessage(playerid, -1"[WANTED LEVEL] Wanted level %s - Stealing an Enforcement vehicle!"GetPlayerWantedLevel(playerid) + 2); 



Re: Error on PlayerStateChange - J0sh... - 15.11.2014

Quote:
Originally Posted by FunnyBear
Посмотреть сообщение
No errors, but in game it comes up as,

Код:
 Wanted level unday - Stealing an Enforcement vehicle!
Unday?
Hmm, check your wanted level code?


Re: Error on PlayerStateChange - AlphaPac - 15.11.2014

Lol, it's because the wanted level is an integer and not a string.

pawn Код:
new string[128];
format(string, sizeof(string), "[WANTED LEVEL] Wanted level %d - Stealing an Enforcement vehicle!", GetPlayerWantedLevel(playerid) + 2);
SendClientMessage(playerid, INFO, string);



Re: Error on PlayerStateChange - J0sh... - 15.11.2014

Quote:
Originally Posted by AlphaPac
Посмотреть сообщение
Lol, it's because the wanted level is an integer and not a string.

pawn Код:
new string[128];
format(string, sizeof(string), "[WANTED LEVEL] Wanted level %d - Stealing an Enforcement vehicle!", GetPlayerWantedLevel(playerid) + 2);
SendClientMessage(playerid, INFO, string);
Ah, YES! I forgot about that.


Re: Error on PlayerStateChange - FunnyBear - 15.11.2014

Quote:
Originally Posted by AlphaPac
Посмотреть сообщение
Lol, it's because the wanted level is an integer and not a string.

pawn Код:
new string[128];
format(string, sizeof(string), "[WANTED LEVEL] Wanted level %d - Stealing an Enforcement vehicle!", GetPlayerWantedLevel(playerid) + 2);
SendClientMessage(playerid, INFO, string);
Thanks, it works!

But, is there a way so that it only adds the wanted level after 30 seconds. For example, if I get in the ambulance, it will add 2+ to my wanted level right away, but if I get out for 10 seconds and get back in, my wanted level would stay the same. It would have to be 30 seconds to a minute before its able to add the wanted level

Thanks


Re: Error on PlayerStateChange - AlphaPac - 15.11.2014

Add the following to where the player enters the vehicles you don't want them in.
pawn Код:
SetTimerEx("wantedtimer",30000,false,"i",playerid);
then add this somewhere else:
pawn Код:
forward wantedtimer(playerid);
public wantedtimer(playerid)
{
    new string[128];
    format(string, sizeof(string), "[WANTED LEVEL] Wanted level %d - Stealing an Enforcement vehicle!", GetPlayerWantedLevel(playerid) + 2);
    SendClientMessage(playerid, INFO, string);
}