#1

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
Reply
#2

is ammurobtdentry a bool ?
Reply
#3

Nope, I'm using this public OnPlayerText(playerid, text[])
Reply
#4

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
Reply
#5

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')
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)