21.06.2011, 20:16
first, my JAIL command:
and the UNJAIL COUNTER and COUNT TIMER:
there,and only player with ID 0 get properly JAIL COUNT with 60 seconds counting backwards, but when I jail other player, he shares the same count![undecided](images/smilies/neutral.gif)
so if player with ID 0 is at 36 SECONDS of jailtime, the other JAILED ID will be at the same time and he'll go in minus -24 and there, counter stops,but the problem is also,player with NON ID 0 will not be set to interior 0,will not be free then?
pawn Код:
COMMAND:jail(playerid, params[])
{
if(GetPlayerColor(playerid) == 0x0259EAAA)
{
new toplayer;
if(!sscanf(params, "ui", toplayer))
{
if(IsPlayerConnected(toplayer))
{
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X,Y,Z);
if(IsPlayerInRangeOfPoint(toplayer, 1.0, X,Y,Z))
{
new string[64];
new name[MAX_PLAYER_NAME], PlayerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
GetPlayerName(toplayer, PlayerName, sizeof(PlayerName));
format(string, sizeof(string), "Cop %s jailed u with 60 sec jail time!", name);
SendClientMessage(toplayer, 0xFFFF00FF, string);
format(string, sizeof(string), "You jailed player: %s", PlayerName);
SendClientMessage(playerid, 0xFFFF00FF, string);
SetPlayerPos(toplayer, 264.6288,77.5742,1001.0391);
SetPlayerInterior(toplayer, 6);
jailed[toplayer] = 1;
SetTimer("UnJail",60000,false); //IMPORTANT
TextDrawShowForPlayer(toplayer,Textdraw7);
TextDrawShowForPlayer(toplayer,Textdraw6);
TextDrawShowForPlayer(toplayer,Textdraw8);
timer = SetTimerEx("test", 1000, 1, "d", toplayer); //IMPORTANT
return 1;
}
else return SendClientMessage(playerid, 0xFFFF00FF, "You not close to a player.");
}
else return SendClientMessage(playerid, 0xFFFF00FF, "Player not on server.");
}
else return SendClientMessage(playerid, 0xFFFF00FF, "Use: /jail [ID player/part of name]");
}
else return SendClientMessage(playerid, 0xFFFF00FF, "You not the cop!");
}
and the UNJAIL COUNTER and COUNT TIMER:
pawn Код:
public test() //this is for JAIL COUNT
{
new toplayer;
{
if(jailed[toplayer] == 1)
{
count--; //Use ++ for counting forwards, and -- for counting the seconds backwards
new string[24];
format(string, sizeof(string), "~y~%d seconds", count);
return TextDrawSetString(Textdraw8, string);
}
return 1;
}
}
public UnJail()
{
for(new v; v < MAX_PLAYERS; v++)
{
if(jailed[v] == 1)
{
SetPlayerPos(v, 1552.9241,-1675.1953,16.1953);
SetPlayerInterior(v, 0);
jailed[v] = 0;
KillTimer(timer);
count = 60;
TextDrawHideForPlayer(v, Textdraw6);
TextDrawHideForPlayer(v, Textdraw7);
TextDrawHideForPlayer(v, Textdraw8);
}
return 1;
}
return 1;
}
there,and only player with ID 0 get properly JAIL COUNT with 60 seconds counting backwards, but when I jail other player, he shares the same count
![undecided](images/smilies/neutral.gif)
so if player with ID 0 is at 36 SECONDS of jailtime, the other JAILED ID will be at the same time and he'll go in minus -24 and there, counter stops,but the problem is also,player with NON ID 0 will not be set to interior 0,will not be free then?