17.12.2011, 13:22
pawn Code:
CMD:setname(playerid, params[])
{ new giveplayerid;
new tmp;
if(sscanf(params, "us", giveplayerid, tmp))
{
SendClientMessage(playerid, 0xFFFFFFAA, "/setname [Playerid/PartOfName] [NewName]");
return 1;
}
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] >= 4)
{ new string[256];
format(string, sizeof(string), "%s.ini", tmp);
if(fexist(string))
{
SendClientMessage(playerid, COLOR_GRAD2, " That Name is registered !");
return 1;
}
if(IsPlayerConnected(giveplayerid))
{ new string2[256];
format(string, sizeof(string), "%s.ini", PlayerName(giveplayerid));
dini_Remove(string);
format(string2, sizeof(string2), "%s.ini", tmp);
dini_Create(string2);
SetPlayerName(giveplayerid, tmp);
format(string, sizeof(string), "You have set %s's name to %s", PlayerName(giveplayerid), tmp);
SendClientMessage(playerid, COLOR_GREY, string);
format(string, sizeof(string), "Your name has been changed from %s to %s", PlayerName(giveplayerid), tmp);
SendClientMessage(giveplayerid, COLOR_YELLOW, string);
SaveAccounts();
OnPlayerDataSave(playerid);
}
else
{
format(string, sizeof(string), "%d is not an active player.", giveplayerid);
SendClientMessage(playerid, COLOR_GRAD2, string);
}
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "You Must be logged in to use this command!");
}
return 1;
}
pawn Code:
(1500)error 035: argument type mismatch (argument 2)
pawn Code:
SetPlayerName(giveplayerid, tmp);