15.03.2011, 13:43
Hello!
This time I'm really stuck.. So, I'm trying to make an Admin system, and it isn't going too well.
I've been searching through scripts that I downloaded for help, searching the forums, and nothing really seems to help me.
The problem is, when I try to make like a
command, I get really stuck. Here's an attempt that's probably way off track.
My OnPlayerConnect:
And OnPlayerDisconnect:
Thanks in advance!
Kind regards,
Ruby.
This time I'm really stuck.. So, I'm trying to make an Admin system, and it isn't going too well.
I've been searching through scripts that I downloaded for help, searching the forums, and nothing really seems to help me.
The problem is, when I try to make like a
pawn Код:
/setadmin
pawn Код:
COMMAND:setadmin(playerid, params[])
{
if(IsPlayerConnected(playerid))
{
if(IsPlayerAdmin(playerid))
{
new id[MAX_PLAYER_NAME], level;
if(sscanf(params, "ui", id, level)) return SendClientMessage(playerid, RED, "SYNTAX: /setadmin <id> <level>");
PlayerInfo[playerid][Adminlevel] = level;
dini_IntSet(file, "Adminlevel", level);
}
}
return 1;
}
pawn Код:
public OnPlayerConnect(playerid)
{
gPlayerLogged[playerid] = 0;
new name[MAX_PLAYER_NAME];
new file[256];
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), SERVER_USER_FILE, name);
if (!dini_Exists(file))
{
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "Please register!", "You're not registered.Please register below", "Register", "Register");
}
if (fexist(file))
{
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "You're registered!", "You are registered. Login below","Login", "Login");
}
return 1;
}
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
new name[MAX_PLAYER_NAME];
new file[256];
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), SERVER_USER_FILE, name);
if (gPlayerLogged[playerid] == 1)
{
dini_IntSet(file, "Score", PlayerInfo[playerid][pScore]);
dini_IntSet(file, "Cash", PlayerInfo[playerid][pCash]);
dini_IntSet(file, "AdminLevel", PlayerInfo[playerid][pAdminlevel]);
}
gPlayerLogged[playerid] = 0;
return 1;
}
Kind regards,
Ruby.