18.05.2011, 16:51
(
Последний раз редактировалось iggy1; 18.05.2011 в 17:01.
Причина: Pawn tag phail
)
I just wrote this not tested it but should work. Requires sscanf plugin and zcmd.
EDIT: I messed the loop up, i fixed it now silly mistake sorry.
pawn Код:
COMMAND:setname(playerid, params[])
{
new
oldname[MAX_PLAYER_NAME], newname[MAX_PLAYER_NAME];
if(sscanf(params, "s[24]s[24]", oldname, newname))
{
SendClientMessage(playerid, -1, "ERROR: Usage /setname [oldname][newname]");
return 1;
}
else
{
new
pCount,
p_zName[MAX_PLAYER_NAME];
for(new i; i != MAX_PLAYERS; i++)//would be better using foreach
{
if(IsPlayerConnected(i))
{
GetPlayerName(i, p_zName, MAX_PLAYER_NAME);
if(!strcmp(oldname, p_zName))//read about strcmp on the wiki you could make it only require a partial string to match or change the case sensitivity on the comparisons.
{
SetPlayerName(i, newname);
count++;
break;
}
}
}
if(!pCount)
SendClientMessage(playerid, -1, "ERROR: Player Not Found!");
}
return 1;
}