@cash text giving errors...
#1

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

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 );
    }
Reply
#3

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...
Reply
#4

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

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

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

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

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...
Reply
#9

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


Forum Jump:


Users browsing this thread: 1 Guest(s)