SA-MP Forums Archive
Help Please! Argument Type Mismatch - 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: Help Please! Argument Type Mismatch (/showthread.php?tid=322593)



Help Please! Argument Type Mismatch - Sal - 02.03.2012

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));


Re: Help Please! Argument Type Mismatch - Nuke547 - 02.03.2012

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;




Re: Help Please! Argument Type Mismatch - MemorexxD - 02.03.2012

Код:
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;
	}



Re: Help Please! Argument Type Mismatch - Sal - 02.03.2012

nada, They are already defined.


Re: Help Please! Argument Type Mismatch - Mike_Peterson - 02.03.2012

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


Re: Help Please! Argument Type Mismatch - Sal - 02.03.2012

Thanks Memorexx yours worked


Re: Help Please! Argument Type Mismatch - ricardo178 - 03.03.2012

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.");
}