SA-MP Forums Archive
@cash text giving errors... - 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: @cash text giving errors... (/showthread.php?tid=392092)



@cash text giving errors... - niels44 - 12.11.2012

hey everyone,

pawn Код:
if(text[0] == '@cash')
    {
        new money = GetPlayerMoney(playerid);
        new string[128], playerName[25];
        GetPlayerName(playerid, playerName, 25);
        format(string, sizeof(string), "%s {FFFFFF}(ID:{FF0000}%d{FFFFFF}): $%d", playerName, playerid, money);
        SendClientMessageToAll(GetPlayerColor(playerid), string);
        return 0;
    }
it gives me this error:
pawn Код:
D:\Program Files\High Speed Drivers\gamemodes\HighSpeedDrivers.pwn(9111) : error 027: invalid character constant
D:\Program Files\High Speed Drivers\gamemodes\HighSpeedDrivers.pwn(9111) : error 027: invalid character constant
now the lines of the error are:
pawn Код:
if(text[0] == '@cash')
    {
now i found out that its the "cash", when i remove the "cash" the errors dissapear, but when i do "@cash" instead of '@зash' that doesnt works neither, so how to do this?

greets niels


Re: @cash text giving errors... - nGen.SoNNy - 12.11.2012

idk... i have

pawn Код:
if( text [ 0 ] == '@' && PlayerInfo[ playerid ][ Admin ] >= 1) {
        new string[128]; GetPlayerName(playerid,string,sizeof(string));
        format(string,sizeof(string),"Admin Chat: %s: %s",string,text[1]); MessageToAdmins(green,string);
        return ( 0 );
    }



Re: @cash text giving errors... - niels44 - 12.11.2012

ye, and that works fine, cuz thats only a @, but as soon as i put something like cash, or money or score etc behind it, it gives me errors...


Re: @cash text giving errors... - nGen.SoNNy - 12.11.2012

But can you put something to work? I mean other word?


Re: @cash text giving errors... - niels44 - 12.11.2012

already did, same problem same errors, if i put like niels, anonym, hello, bye, etc all gives same errors


Re: @cash text giving errors... - nGen.SoNNy - 12.11.2012

maybe this function is just for characters like #$#%@^!^ not for simple words


Re: @cash text giving errors... - Jefff - 12.11.2012

replace
if(text[0] == '@cash')
to
if(!strcmp(text,"@cash"))


Re: @cash text giving errors... - niels44 - 12.11.2012

YAY worked jeff, thnx , now i think about it, it all makes sence xD, anyways thnx

also, is there something to check if a player already said something before it, like something:

hey everyone, i have @cash, like it?

so that the @cash autom recognizes it, instead of just only can put it at start of the chat...


Re: @cash text giving errors... - Jefff - 12.11.2012

https://sampwiki.blast.hk/wiki/Strfind