09.01.2011, 11:52
I have some problems with admin jail commands
when player jailed it just says 0 seconds and i dont get teleported to the lspd jail(the coordinates must be right)
and also this, i made if you type 3 times wrong password you get kicked, but here you get kicked if you just type it wrong 1 time
here is code
under onplayerconnect
i will just show dialog 2(login dialog)
i really need help on these ones
i dont get any errors/warnings
when player jailed it just says 0 seconds and i dont get teleported to the lspd jail(the coordinates must be right)
pawn Код:
forward Unjail (pid);
pawn Код:
dcmd_jail(playerid, params[])
{
if(!PLVL[playerid]) return 0;
new pid, adminname[MAX_PLAYER_NAME], paramname[MAX_PLAYER_NAME];
if(PlayerInfo[playerid][pAdminLevel] >=1)
{
if(sscanf(params, "ud", pid)) return SendClientMessage(playerid, Yellow, "Usage: /ajail <playerid> <time>");
if(!IsPlayerConnected(pid)) return SendClientMessage(playerid, Red, "This player is not connected");
new Second, string[128], string2[128], string3[128], string4[128];
GetPlayerName(pid, paramname, sizeof(paramname));
GetPlayerName(playerid, adminname, sizeof(adminname));
new file[256], name[MAX_PLAYER_NAME];
format(file, sizeof(file), SERVER_USER_FILE, name);
if(dini_Exists(file))
{
dini_IntSet(file, "Jailed", Second);
}
format(string, sizeof(string), "%s (ID: %d) has been jailed by %s for %d seconds", paramname, pid, adminname, Second);
format(string2, sizeof(string2), "You have been jailed by %s for %d seconds", adminname, Second);
SendClientMessageToAll(AdminColor, string);
SendClientMessage(pid,AdminColor,string2);
SetPlayerInterior(pid,6);
SetPlayerPos(pid, 64.6288,77.5742,1001.0391);
SetPlayerArmour(pid,0);
ResetPlayerWeapons(pid);
SetTimerEx ("Unjail", Second*1000, 0, "i", pid);
} else if(PlayerInfo[playerid][pAdminLevel] == 0) return 0;
return 1;
}
pawn Код:
public Unjail (pid)
{
SetPlayerInterior(pid,0);
SetPlayerPos(pid,1383.1418,2185.1440,11.0234);
TogglePlayerControllable(pid,1);
}
here is code
pawn Код:
new PasswordLogTries[MAX_PLAYERS];
under onplayerconnect
pawn Код:
PasswordLogTries[playerid] = 0;
pawn Код:
if (dialogid == 2)
{
new name[MAX_PLAYER_NAME], file[128], pid;
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), SERVER_USER_FILE, name);
if(!response) return Kick(playerid);
if (!strlen(inputtext)) return ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Login to your account", "Enter your password", "Login", "Quit");
new tmp;
tmp = dini_Int(file, "Password");
if(udb_hash(inputtext) != tmp)
{
PasswordLogTries[playerid]++;
if(PasswordLogTries[playerid] < 3) ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Login to your account", "Wrong password ! \nEnter your password", "Login", "Quit");
SendClientMessage(playerid, AdminColor, "Too many incorrect passwords!");
Kick(pid);
}
i dont get any errors/warnings