30.09.2011, 16:14
Hi,
I've been working on my /jail command but I'm not that good with timers and I need soemthing that will relese the player after the added time ends.
Here is the command itself:
Thanks!
I've been working on my /jail command but I'm not that good with timers and I need soemthing that will relese the player after the added time ends.
Here is the command itself:
pawn Код:
if(strcmp(cmd, "/jail", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(gTeam[playerid] == 5 || gTeam[playerid] == 6)
{
if(!PlayerToPoint(6.0, playerid, 268.3327,77.8972,1001.0391))
{
SendClientMessage(playerid, COLOR_GREY, " You are not near the Jail, can't Arrest !");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GREY, " USAGE: /jail [fine] [time]");
return 1;
}
moneys = strval(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GREY, " USAGE: /jail [fine] [time]");
return 1;
}
new time = strval(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GREY, " USAGE: /jail [fine] [time]");
return 1;
}
if(IsPlayerConnected(giveplayerid))
{
if(GetDistanceBetweenPlayers(playerid, giveplayerid) < 5)
{
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* You arrested %s !", giveplayer);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
GivePlayerMoney(giveplayerid, -moneys);
format(string, sizeof(string), "~r~Fine: $%d", moneys);
GameTextForPlayer(giveplayerid, string, 5000, 5);
SetPlayerInterior(giveplayerid, 6);
SetPlayerPos(giveplayerid,264.6288,77.5742,1001.0391);
PlayerInfo[giveplayerid][pJailTime] = time * 60;
PlayerInfo[giveplayerid][pJailed] = 1;
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " That player is too far away.");
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " You are not authorized to use that command.");
}
}
return 1;
}
return 0;
}