!INVALID_PLAYER_ID
#1

MY CODE:
Code:
202CMD:bal(playerid, params[])
203{
204	new targetid;
205    new money2 = GetPlayerMoney(targetid);
206	new money = GetPlayerMoney(playerid);
207	new a[MAX_PLAYER_NAME+51];
208    format(a, sizeof(a), "{0FD620}Balance:{F50C0C} $%s", money);
209    SendClientMessage(playerid, -1, a);
210    if(!strcmp(selection, !INVALID_PLAYER_ID, true))
211    {
212        new name[MAX_PLAYER_NAME];
213	    GetPlayerName(targetid, name, sizeof(name));
214        format(a, sizeof(a), "{0FD620}Balance of %s:{F50C0C} $%s",name,money2);
215	    SendClientMessage(playerid, -1, a);
216 	}
217 	return 1;
218}
ERROR:
Code:
(210) : error 035: argument type mismatch (argument 2)
Reply
#2

I have no idea what u want to do but u can't compare a string with an integer that way(presuming selection its a string)
Enentually you can transform selection into a integer(presuming you store some sort of id) and then compare with invalid_player_id
Reply
#3

what i was tryna' do was if he just writes /bal, it only shows his money. but if he does /bal <playerid/playername> he gets the balance of another player
Reply
#4

You can make this way simple using sscanf
PHP Code:
CMD:bal(playeridparams[])
{
    new 
targetid;
    new 
money GetPlayerMoney(playerid);
    new 
a[128];

    if(
sscanf(params"u"targetid))
    {
        
format(asizeof(a), "{0FD620}Balance:{F50C0C} $%s"money);
        
SendClientMessage(playerid, -1a);
        return 
1;
    }    
    if(!
IsPlayerConnected(targetid)) return SendClientMessage(playerid, -1"Error: Specified player is not connected.");

    new 
money2 GetPlayerMoney(targetid);

    new 
name[MAX_PLAYER_NAME];
    
GetPlayerName(targetidnamesizeof(name));
    
format(asizeof(a), "{0FD620}Balance of %s:{F50C0C} $%s",name,money2);
    
SendClientMessage(playerid, -1a);
     return 
1;

Reply
#5

thanks, i think its time to learn sscanf..
Reply
#6

Quote:
Originally Posted by SeanDenZYR
View Post
thanks, i think its time to learn sscanf..
Better to also learn how to use simple checks though too.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)