04.06.2010, 12:28
Hey gys, i have 2 problems...
my first:
I have a command to create a few vehicles that i defined before with CreateVehicle();
but the Cars are auto respawnin when they get destroyed. (i set the respawn_delay to -1)
second prob:
i have an admin script but no /register and /login system.
so i want to set the adminlevel of a person to 1,2 or 3 with /makeadmin [ID] [Level] and then save it into a file and when he types /login then the file should load, but it doesnt save i think.
maybe u can help...
CODE:
my first:
I have a command to create a few vehicles that i defined before with CreateVehicle();
but the Cars are auto respawnin when they get destroyed. (i set the respawn_delay to -1)
second prob:
i have an admin script but no /register and /login system.
so i want to set the adminlevel of a person to 1,2 or 3 with /makeadmin [ID] [Level] and then save it into a file and when he types /login then the file should load, but it doesnt save i think.
maybe u can help...
CODE:
pawn Код:
CMD:makeadmin(playerid, params[])
{
if (IsPlayerAdmin(playerid) || Player[playerid][ALevel] >= 3)
{
if (sscanf(params, "ud", params[0], params[1]))
{
SendClientMessage(playerid, RED, "SERVER: USAGE: /makeadmin [ID] [level]");
}
else if (params[0] == INVALID_PLAYER_ID)
{
SendClientMessage(playerid, RED, "SERVER: Ungьltige User-ID");
}
else
{
new file[128];
new pname[56];
new string[256];
if (params[0] != playerid)
{
GetPlayerName(params[0], pname, sizeof(pname));
format(string, sizeof(string), "*** Du hast %s zum Admin Stufe %d gemacht.", pname, params[1]);
SendClientMessage(playerid, ORANGE, string);
GetPlayerName(playerid, pname, sizeof(pname));
format(string, sizeof(string), "*** %s hat dich zum Admin Stufe %d gemacht.", pname, params[1]);
SendClientMessage(params[0], ORANGE, string);
}
else
{
format(string, sizeof(string), "*** Du hast dich selbst auf Adminlevel %d gesetzt.", params[1]);
SendClientMessage(playerid, ORANGE, string);
}
SendClientMessage(params[0], YELLOW, "*** Du kannst dich jetzt mit /login [password] einloggen.");
SendClientMessage(params[0], YELLOW, "*** Das Passwort kannst du bei dem Serverowner oder einem anderen Admin erfragen.");
GetPlayerName(params[0], pname, sizeof(pname));
format(file, sizeof(file), "%s.datei", pname);
if (fexist(file))
{
SendClientMessage(playerid, RED, "SERVER: Der Spieler ist bereits Admin");
}
Player[playerid][ALevel] = params[1]
dini_IntSet(file, "ALevel", Player[playerid][ALevel]);
dini_IntSet(file, "Sprache", gSprache[playerid]);
}
}
else
{
SendClientMessage(playerid, RED, "SERVER: Du bist nicht als Admin eingeloggt oder dein Adminlevel ist zu niedrig");
}
return 1;
}
// --Login- And RegisterCommands--
CMD:login(playerid, params[])
{
if (!IsPlayerAdmin(playerid))
{
if (sscanf(params, "s", params[0]))
{
SendClientMessage(playerid, RED, "SERVER: USAGE: /login [password]");
}
else if (strcmp(params[0], gpassword, true))
{
SendClientMessage(playerid, RED, "SERVER: Falsches Passwort");
}
else
{
new file[128]
new pname[56];
new string[256];
GetPlayerName(playerid, pname, sizeof(pname));
SendClientMessage(playerid, YELLOW, "*** Du hast dich als Admin eingloggt.");
SendClientMessage(playerid, YELLOW, "*** Dir stehen jetzt neue Adminbefehle zur Verfьgung.");
format(file, sizeof(file), "%s.datei", pname);
Player[playerid][Sprache] = dini_Int(file, "Sprache");
Player[playerid][ALevel] = dini_Int(file, "ALevel");
for (new i=0; i<MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
if (gSprache[playerid] == GERMAN)
{
format(string, sizeof(string), "*** %s hat sich als Admin eingeloggt.", pname);
}
else
{
format(string, sizeof(string), "*** %s logged in as Admin.", pname);
}
SendClientMessage(i, ORANGE, string);
}
}
}
}
else
{
SendClientMessage(playerid, RED, "SERVER: Du bist bereits als Admin eingeloggt");
}
return 1;
}