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: Help (
/showthread.php?tid=576681)
Help -
sscarface - 06.06.2015
PHP код:
if(text[0] == '10')
{
if(ammurobtdentry{playerid} == true)//If they are in the checkpoint, they can use the chat to respond to it.
{
if(GetPlayerMoney(playerid) > 999)
{
GivePlayerMoney(playerid,-1000);
SetPlayerArmour(playerid,100.0);
SendClientMessage(playerid, GREEN,"You have purchased Sawnoff Shotgun for $1,000");
} else SendClientMessage(playerid, RED, "You don't have enough money.");
return false;
}
}
PHP код:
(2770) : error 027: invalid character constant
(2770) : error 027: invalid character constant
(2770 -- 2771) : error 029: invalid expression, assumed zero
(2770 -- 2771) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
4 Errors.
What is this? I can't add '10'? Is there any way to fix it or avoid it and make it work? Thanks
Re: Help -
Evocator - 06.06.2015
is ammurobtdentry a bool ?
Re: Help -
sscarface - 06.06.2015
Nope, I'm using this public OnPlayerText(playerid, text[])
Re: Help -
Threshold - 06.06.2015
??
text[0] means you are trying to get a character (index) from the string "text". Valid "characters" for example would be 'a', '$', '#', 'L', 'V', but not '10'...
http://www.asciitable.com/
Pawno uses the 'Dec' value of each character. For example:
and
mean the exact same thing, because the 'Dec' value for "&" is 38.
References:
https://sampwiki.blast.hk/wiki/Strval
Re: Help -
Konstantinos - 06.06.2015
You can compare 1 character (a character is basically a number) at a time so it'd be:
pawn Код:
if(text[0] == '1' && text[1] == '0')