SA-MP Forums Archive
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(playeridGREEN,"You have purchased Sawnoff Shotgun for $1,000");
            } else 
SendClientMessage(playeridRED"You don't have enough money.");
            return 
false;
        }
    } 
PHP код:
(2770) : error 027invalid character constant
(2770) : error 027invalid character constant
(2770 -- 2771) : error 029invalid expressionassumed zero
(2770 -- 2771) : fatal error 107too many error messages on one line
Compilation aborted
.Pawn compiler 3.2.3664              Copyright (c1997-2006ITB 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

pawn Код:
if(strval(text) == 10)
??

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:
pawn Код:
if(text[0] == '&')
and
pawn Код:
if(text[0] == 38)
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')