Need another help - jail timer -
Striker_Moe - 13.09.2009
Im working on a anti-teamkill.. and so.. yeah.
Код:
public OnPlayerDeath(playerid,killerid,reason)
{
SendDeathMessage(killerid, playerid, reason);
if (GetPlayerColor(playerid) == GetPlayerColor(killerid))
{
new name[MAX_PLAYER_NAME], string[128];
GetPlayerName(killerid, name, sizeof(name));
format(string, sizeof(string), ":: SERVER jailed %s for 1 minute. Reason: Team-killing! ::", name );
SendClientMessageToAll(COLOR_GREEN, string);
SetPlayerInterior(killerid, 6);
SetPlayerPos(killerid,264.6288,77.5742,1001.0391);
SetCameraBehindPlayer(killerid);
SetTimer("tkjail",60000,false);
ResetPlayerWeapons(killerid);
return 1;
}
At the top I got forward tkjail(), but i get bunches of errors when I try to unjail the dude again in a public! How to do?
Re: Need another help - jail timer -
Striker_Moe - 13.09.2009
Anyone?
Re: Need another help - jail timer -
Striker_Moe - 14.09.2009
Up
Re: Need another help - jail timer -
Calgon - 14.09.2009
Paste the errors.
Re: Need another help - jail timer -
Clavius - 14.09.2009
If tkjail is what releases the player from jail, then it should have a
playerid parameter.
public tkjail(playerid)
In this case, SetTimerEx is needed insted of SetTimer.
Also, you should use a variable to check if the player is in prison, so you can later use it do deny teleporting or suicide for the player.
Here is an example code:
pawn Код:
new bool:PlayerInPrison[MAX_PLAYERS];
forward tkjail(playerid);
[...]
public tkjail(playerid)
{
SetPlayerPos(playerid, X, Y, Z); // coordinates here should be the position where you want the player to be released
SetPlayerInterior(playerid, 0); // or other, if needed
PlayerInPrison[playerid] = false;
}
You'd need to add PlayerInPrison[playerid] = true; when the player gets jailed, and don't forget to set it to false on OnPlayerDisconnect(playerid), in case someone quits while in jail
Re: Need another help - jail timer -
Striker_Moe - 14.09.2009
Okay, I now got at the top
forward tkjail(playerid);
new bool:PlayerInPrison[MAX_PLAYERS];
When getting jailed:
PlayerInPrison[playerid] = true;
OnPlayerCommandText:
if (PlayerInPrison[playerid] == 1)
{
return 0;
}
And when released:
public tkjail(playerid)
{
SetPlayerHealth(playerid,0.0);
PlayerInPrison[playerid] = false;
}
But you dont get released! D: Why?