20.04.2012, 16:59
Hey,
I have a problem with my command which is /setname:
When I set a players name, they relog with the new name and the name doesn't exist. Basically like a temporary name change. Can anyone make this a permanent name change by changing the current name of the .ini file created ?
Regards,
Sean aka sniperwars
I have a problem with my command which is /setname:
pawn Код:
dcmd_setname(playerid,params[])
{
if(PlayerInfo[playerid][Level] >= 3 || IsPlayerAdmin(playerid)) {
new tmp[256], tmp2[256], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index);
if(!strlen(tmp) || !strlen(tmp2)) return SendClientMessage(playerid, COLOR_RED, "[USAGE]: /setname [playerid] [new name]");
new player1 = strval(tmp), length = strlen(tmp2), string[128];
if(length < 3 || length > MAX_PLAYER_NAME) return SendClientMessage(playerid, COLOR_RED,"[ERROR]: Incorrect Name Length");
if(PlayerInfo[player1][Level] == ServerInfo[MaxAdminLevel] && PlayerInfo[playerid][Level] != ServerInfo[MaxAdminLevel]) return SendClientMessage(playerid, COLOR_RED, "[ERROR]: You cannot use this command on this admin");
if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID) {
format(string, sizeof(string), "You have set \"%s's\" name to \"%s\" ", pName(player1), tmp2); SendClientMessage(playerid,COLOR_ORANGE,string);
if(player1 != playerid) { format(string,sizeof(string),"Administrator \"%s\" has set your name to \"%s\" ", pName(playerid), tmp2); SendClientMessage(player1, COLOR_BLUE, string); }
SetPlayerName(player1, tmp2);
return OnPlayerConnect(player1);
} else return SendClientMessage(playerid, COLOR_RED,"[ERROR]: Player is not connected");
} else return SendClientMessage(playerid, COLOR_RED,"[ERROR]: You are not a high enough level to use this command");
}
Regards,
Sean aka sniperwars