Help Please! Argument Type Mismatch
#1

Whenever i compile this it says Argument type mismatch
pawn Код:
if(strcmp(cmd, "/ip", true, 3) == 0)
    {
        if(PlayerInfo[playerid][Admin] >= 1)
        {
            tmp = strtok(cmdtext, idx);
            GetPlayerName(tmp, pName, sizeof(pName));
            GetPlayerIp(tmp, Ip, sizeof(Ip));
            format(string, sizeof(string), "%s IP is %s", pName, Ip);
            SendClientMessage(playerid, 0xFF0000AA, string);
        }
        else
        {
            SendClientMessage(playerid, 0xFF0000AA, "You are not Admin");
        }
        return 1;
    }
    return 0;
two errors
1 on
GetPlayerName(tmp, pName, sizeof(pName));
and one on
GetPlayerIp(tmp, Ip, sizeof(Ip));
Reply
#2

Try this:

PHP код:
if(strcmp(cmd"/ip"true3) == 0)
    {
        if(
PlayerInfo[playerid][Admin] >= 1)
        {
            new 
tmp strtok(cmdtextidx);
            new 
name[MAX_PLAYER_NAME],ip[32];
            
GetPlayerName(tmpnamesizeof(name));
            
GetPlayerIp(tmpipsizeof(ip));
            
format(stringsizeof(string), "%s IP is %s"nameip);
            
SendClientMessage(playerid0xFF0000AAstring);
        }
        else
        {
            
SendClientMessage(playerid0xFF0000AA"You are not Admin");
        }
        return 
1;
    }
    return 
0;

Reply
#3

Код:
if(strcmp(cmd, "/ip", true) == 0)
	{
		if (PlayerInfo[playerid][pAdmin] >= 1)
		{
                        new idx;
                        tmp = strtok(cmdtext,idx);
			new playersip[256];
			if(!strlen(tmp))
			{
  				SendClientMessage(playerid, COLOR_DGOLD, "USE:{FFFFFF} /ip [PlayerID]");
		        return 1;
			}
 			giveplayerid = ReturnUser(tmp);
 			GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
			GetPlayerIp(giveplayerid,playersip,sizeof(playersip));
 			format(string, sizeof(string), "INFO: %s is %s",giveplayer,playersip);
			SendClientMessage(playerid,COLOR_GOLD,string);
		}
               else
               {
               SendClientMessage(playerid, 0xFF0000AA, "You are not Admin");
               }
		return 1;
	}
Reply
#4

nada, They are already defined.
Reply
#5

Two things, I could be wrong though, it's late.. and I haven't used strcmp for a long time.
1. Wheres new Ip[16],pName[MAX_PLAYER_NAME];
2. Shouldn't it be strval(tmp)? if not, don't explain or blame, just say so.. going to bed in a sec
Reply
#6

Thanks Memorexx yours worked
Reply
#7

Just... Make it in a better way, to evict lose identation:
pawn Код:
if(strcmp(cmd, "/ip", true) == 0)
{
    if (PlayerInfo[playerid][pAdmin] >= 1)
    {
        new idx;
        tmp = strtok(cmdtext,idx);
        new playersip[256];
        if(!strlen(tmp))
        {
            SendClientMessage(playerid, COLOR_DGOLD, "USE:{FFFFFF} /ip [PlayerID]");
            return 1;
        }
        giveplayerid = ReturnUser(tmp);
        GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
        GetPlayerIp(giveplayerid,playersip,sizeof(playersip));
        format(string, sizeof(string), "INFO: %s is %s",giveplayer,playersip);
        SendClientMessage(playerid,COLOR_GOLD,string);
        return 1;
    }
    else return SendClientMessage(playerid, 0xFF0000AA, "You are not admin.");
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)