10.06.2011, 02:02
PHP код:
if (strcmp("/permitirnome", cmdtext, true) == 0)
{
#define SCM SendClientMessage
if!IsPlayerAdmin(playerid)) return SCM(playerid, -1, "Vocк nгo й adm rcon");
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SCM(playerid, -1, "Use /permitirnome ID");
new id = ReturnUser(tmp);
if(!IsPlayerConnected(id)) return SCM(playerid, -1, "ID offline.");
SetPVarInt(id, "Nome", 1);
return 1;
}
if (strcmp("/nome", cmdtext, true) == 0)
{
if(GetPVarInt(playerid, "Nome") == 0) return SendClientMessage(playerid, -1, "Vocк nгo pode trocar o nome.");
ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"nome","Digite o seu nome","Ok","Sair");
return 1;
}
if(dialogid == 1)
{
if(!response) return 1;
if(!strlen(inputtext)) return SendClientMessage(playerid, -1, "Digite algo");
new string[0x3C], nome[MAX_PLAYER_NAME], nome2[MAX_PLAYER_NAME], string2[0x3C];
GetPlayerName(playerid, nome, sizeof(nome));
format(string, sizeof(string), "Contas/%s", nome);
if(dini_Exists(string)) dini_Remove(string);
SetPlayerName(playerid,strlen(inputtext));
GetPlayerName(playerid, nome2, sizeof(nome2));
format(string2, sizeof(string2), "Contas/%s", nome2);
dini_Create(string2);
return 0x01;
}
Otro
PHP код:
zcmd(changename, playerid, params[])
{
new player,name[MAX_PLAYER_NAME],name2[MAX_PLAYER_NAME];
if (!sscanf(params, "us", player, name))
{
if(player != INVALID_PLAYER_ID)
{
if(IsPlayerAdmin(playerid))
{
new string[0x3C];
GetPlayerName(playerid, name2, sizeof(name2));
format(string, sizeof(string), "Contas/%s.ini", name2);
frename(name2,name);
SetPlayerName(player,name);
fremove(string);
format(string, sizeof(string), "Nome mudado para %s.", name);
SendClientMessage(player, yellow, string);
}
else return SendClientMessage(playerid, -1, "ERROR: Vocк nгo й adm rcon.");
}
else return SendClientMessage(playerid, -1, "ERROR: Jogador inexistente.");
}
else return SendClientMessage(playerid, -1, "/mudarnome ID NOVONOME]");
return 1;
}