Quote:
Originally Posted by Djair_Black
Gosto mais assim:
pawn Код:
if(strcmp(cmd,"/nadmin", true)==0) { new aname[MAX_PLAYER_NAME]; GetPlayerName(playerid, aname, MAX_PLAYER_NAME); format(file, sizeof(file), psContas, aname); if(PlayerInfo[playerid][pAdmin] == 5){ new tmp[256]; new plid, nadmin; tmp = strtok(cmdtext, idx); if(!strlen(tmp)){ SendClientMessage(playerid, VERMELHO_TD, "** [INFO] /nadmin [ID] [1 -- 5]"); return 1; } plid = strval(tmp); tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, VERMELHO_TD, "** [INFO] /nadmin [ID] [1 -- 5]"); return 1; } nadmin = strval(tmp); if(IsPlayerConnected(plid)){ PlayerInfo[playerid][pAdmin] = nadmin; new pname[MAX_PLAYER_NAME]; GetPlayerName(plid, pname, MAX_PLAYER_NAME); format(string, sizeof(string), "** [INFO] O Administrador %s (%d) setou o seu nнvel Administrativo para: %s", aname, playerid, NivelAdmin(nadmin)); SendClientMessage(plid,tcadm, string); SendClientMessage(playerid, Verde, "** [INFO] Comando efetuado com sucesso!"); return 1; }else{ SendClientMessage(playerid, VERMELHO_TD, "*** [ERRO] Jogador nгo conectado."); return 1; } } }
pawn Код:
stock NivelAdmin(nivel) { new str[30]; if(nivel == 0) { str = "Nгo Administrador"; } else if(nivel == 1) { str = "Moderador"; } else if(nivel == 2) { str = "Auxiliar"; } else if(nivel == 3) { str = "Administrador"; } else if(nivel == 4) { str = "Sub-Dono"; } else if(nivel == 5) { str = "Dono"; } return str; }
|
NOSSA! Que code lindo
Sente sу a diferenзa (organizaзгo):
pawn Код:
if(strcmp(cmd,"/nadmin", true) == 0)
{
new aname[MAX_PLAYER_NAME];
GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
format(file, sizeof(file), psContas, aname);
if(PlayerInfo[playerid][pAdmin] == 5)
{
new tmp[156],plid, nadmin;
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, VERMELHO_TD, "** [INFO] /nadmin [ID] [1 -- 5]");
plid = strval(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, VERMELHO_TD, "** [INFO] /nadmin [ID] [1 -- 5]");
nadmin = strval(tmp);
if(!IsPlayerConnected(plid)) return SendClientMessage(playerid, VERMELHO_TD, "*** [ERRO] Jogador nгo conectado.");
PlayerInfo[playerid][pAdmin] = nadmin;
new pname[MAX_PLAYER_NAME];
GetPlayerName(plid, pname, MAX_PLAYER_NAME);
format(string, sizeof(string), "** [INFO] O Administrador %s (%d) setou o seu nнvel Administrativo para: %s", aname, playerid, NivelAdmin(nadmin));
SendClientMessage(plid,tcadm, string);
SendClientMessage(playerid, Verde, "** [INFO] Comando efetuado com sucesso!");
return 1;
}
return 1;
}
E zcmd + sscanf й bem melhor