pawn Код:
public OnPlayerConnect(playerid) {
new nome[24];
GetPlayerName(playerid, nome, 24);
new local_conta[35];
format (local_conta, 35, "Contas/%s.ini", nome);
if ( fexist(local_conta) )
SetPVarInt(playerid, "nivel_admin", DOF2_GetInt(local_conta, "nivel_admin"));
return 1;
}
public OnPlayerDisconnect(playerid, reason) {
new nome[24];
GetPlayerName(playerid, nome, 24);
new local_conta[35];
format (local_conta, 35, "Contas/%s.ini", nome);
if ( !fexist(local_conta) )
DOF2_CreateFile(local_conta);
DOF2_SetInt(local_conta, "nivel_admin", GetPVarInt(playerid, "nivel_admin"));
DOF2_SaveFile();
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[]) {
new comando[20], parametros[50];
sscanf(cmdtext, "s[20]s[50]", comando, parametros);
if(!strcmp(comando, "/souadmin", true)) {
if ( GetPVarInt(playerid, "nivel_admin") == 0 )
SendClientMessage(playerid, -1, "Nгo!");
else
SendClientMessage(playerid, -1, "Sim!");
return 1;
}
if(!strcmp(comando, "/pegaradmin", true)) {
SetPVarInt(playerid, "nivel_admin", 1);
SendClientMessage(playerid, -1, "Agora vocк й admin!");
return 1;
}
return 0;
}
public OnGameModeExit() {
DOF2_Exit();
return 1;
}