CMD:kip(playerid, params[]) { if(PlayerInfo[playerid][pAdmin] == 6) { new ip[32], inputip; if(sscanf(params, "s[32]", inputip)) return SendClientMessage(playerid, WHITE, "USAGE:/kip [IP]"); for(new p=0; p<MAX_PLAYERS; p++) { if(IsPlayerConnected(p)) { GetPlayerIp(p, ip, sizeof(ip)); if(strcmp(inputip, ip, true)) <==== Argument type mistmach 1 { Kick(p); } } } new str[128], adname[MAX_PLAYER_NAME]; GetPlayerName(playerid, adname, sizeof(adname)); format(str, sizeof(str), "ADMIN %s kick all players with IP: %s", adname, inputip); SendClientMessageToAll(RED, str); } else return SendClientMessage(playerid, RED, "You are not a admin!"); return 1; }
CMD:kip(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] == 6)
{
new ip[32], inputip[32];
if(sscanf(params, "s[32]", inputip)) return SendClientMessage(playerid, WHITE, "USAGE:/kip [IP]");
for(new p=0; p<MAX_PLAYERS; p++)
{
if(IsPlayerConnected(p))
{
GetPlayerIp(p, ip, sizeof(ip));
if(strcmp(inputip, ip, true))
{
Kick(p);
}
}
}
new str[128], adname[MAX_PLAYER_NAME];
GetPlayerName(playerid, adname, sizeof(adname));
format(str, sizeof(str), "ADMIN %s kick all players with IP: %s", adname, inputip);
SendClientMessageToAll(RED, str);
}
else return SendClientMessage(playerid, RED, "You are not a admin!");
return 1;
}
CMD:kip(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] == 6)
{
new ip[16], inputip[16];
if(sscanf(params, "s[16]", inputip)) return SendClientMessage(playerid, WHITE, "USAGE:/kip [IP]");
for(new p=0; p<MAX_PLAYERS; p++)
{
if(IsPlayerConnected(p))
{
GetPlayerIp(p, ip, sizeof(ip));
if(strcmp(inputip, ip, true)) <==== Argument type mistmach 1
{
Kick(p);
}
}
}
new str[128], adname[MAX_PLAYER_NAME];
GetPlayerName(playerid, adname, sizeof(adname));
format(str, sizeof(str), "ADMIN %s kick all players with IP: %s", adname, inputip);
SendClientMessageToAll(RED, str);
}
else return SendClientMessage(playerid, RED, "You are not a admin!");
return 1;
}
ip size is 16 not 32 and you defined inputip as a normal veriable not a string and you are using it as string ?
pawn Код:
|
The max IP size is 16, so why would you use 32? That's just a waste of 64 bytes.
|
The max IP size is 16, so why would you use 32? That's just a waste of 64 bytes.
|
if(strcmp(inputip, ip, true))
if(!strcmp(inputip, ip, true))