20.07.2009, 11:34
Код:
forward Jail(playerid, time);
forward jailcount(time);
//Jail
//==============================================================================
new JailCount = -1;
public Jail(playerid, time)
{
if(JailCount == -1)
{
JailCount = time;
SetTimer("jailcount",5000,0);
}
}
public jailcount(time)
{
new string[128];
JailCount--;
if(JailCount==0)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
GameTextForPlayer(i,"~g~You are Free to go~ r~!",1000,6);
PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
SetPlayerPos(i,267.9442,77.4124,1001.0391);
SendClientMessage(i,COLOR_GREEN,"[ ! ] Jail time is over !");
SendClientMessage(i,COLOR_GREEN,"[ ! ] You are free to go !");
}
return 0;
}
else
{
new text[7]; format(text,sizeof(text),"~w~%d",JailCount);
for(new i = 0; i < MAX_PLAYERS; i++)
{
PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
GameTextForPlayer(i,text,1000,6);
SendClientMessage(i,COLOR_RED,"[ ! ] You Are In Jail !");
SetPlayerInterior(i, 6);
SetPlayerPos(i,265.0813,77.5967,1001.0391);
format(string,sizeof(string), "[ ! ] You are jailed for: %d sec. ! ",JailCount);
SendClientMessage(i, COLOR_LIGHTRED, string);
}
}
SetTimer("jailcount",1000,0);
return 0;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
// JAIL
if (strcmp(cmd,"/ajail", true,5) == 0)
{
if(strlen(tmp) == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "USAGE: /ajail »[playerid]« [time]");
id = strval(tmp);
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_LIGHTRED, "[ ! ] That player isn't active.");
new time = strval(tmp);
if(strlen(tmp) == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "USAGE: /ajail [playerid] »[time]«");
Jail(id,time);
GetPlayerName(playerid, Aname, sizeof(Aname));
GetPlayerName(playerid, Idname, sizeof(Idname));
format(string,sizeof(string), "[ ! ] You have been jailed by %s for %d sec ! ",Aname,time);
SendClientMessage(id,COLOR_LIGHTRED, string);
format(string,sizeof(string), "[ ! ] You have jailed %s for %d sec ! ",id,time);
SendClientMessage(playerid,COLOR_LIGHTRED, string);
}
}
When I try to jail someone, it's suppose to be "/ajail id time", I only can put the id because it does not identifies the variable "time". I can say that I don't know who to make a command that uses 2 variables.

The second problem is when I jail a player, all current online players are jailed

I am new on this pawn scripting, I wish some help from the experience people.
Best Regards,
Joгo Assunзгo.
PS: If i didn't post in the right section, i am sorry for that !

