07.12.2009, 13:50
dcmd_arrest(playerid, params[])
{
if (strlen(params))
{
id = strval(params);
if (IsPlayerConnected(id) && (gTeam[playerid] != TEAM_HEAL) && (gTeam[playerid] != TEAM_CIVIL) && (GetDistanceBetweenPlayers( playerid, id) < 5.0 ) && (GetPlayerWantedLevel(id) >= 4) && (gTeam[id] != TEAM_COPS) && (gTeam[id] != TEAM_CIA))
{
if(GetPlayerWantedLevel(id) == 4)
{
SendClientMessage(id, COLOR_RED , "You have been Arrested");
SendClientMessage(playerid, 0x00FF00AA, "Criminal arrested. Good Job!");
ResetPlayerWeapons(id);
SetPlayerHealth(id,100.0);
SetPlayerScore(playerid, GetPlayerScore( playerid ) +1 );
SetPlayerWantedLevel(id, 0);
SetPlayerColor(id,COLOR_WHITE);
GameTextForPlayer(playerid, "~y~Player Arrested~n~+1500$", 3500, 3);
GameTextForPlayer(id, "~r~You have been arrested~n~-1500$", 3500, 3);
GivePlayerMoney(id, -2000);
GivePlayerMoney(playerid, 2000);
SetPlayerPos(id, 2340.2749,2457.5000,14.968;
}
if(GetPlayerWantedLevel(id) == 5)
{
SendClientMessage(id, COLOR_RED , "You have been Arrested");
SendClientMessage(playerid, 0x00FF00AA, "Criminal arrested. Good Job!");
ResetPlayerWeapons(id);
SetPlayerHealth(id,100.0);
SetPlayerScore(playerid, GetPlayerScore( playerid ) +1 );
SetPlayerWantedLevel(id, 0);
SetPlayerColor(id,COLOR_WHITE);
GameTextForPlayer(playerid, "~y~Player Arrested~n~+2500$", 3500, 3);
GameTextForPlayer(id, "~r~You have been arrested~n~-2500$", 3500, 3);
GivePlayerMoney(id, -2500);
GivePlayerMoney(playerid, 2500);
SetPlayerPos(id, 2340.2749,2457.5000,14.968;
}
if(GetPlayerWantedLevel(id) >= 6)
{
SendClientMessage(id, COLOR_RED , "You have been Arrested");
SendClientMessage(playerid, 0x00FF00AA, "Criminal arrested. Good Job!");
ResetPlayerWeapons(id);
SetPlayerHealth(id,100.0);
SetPlayerScore(playerid, GetPlayerScore( playerid ) +1 );
SetPlayerWantedLevel(id, 0);
SetPlayerColor(id,COLOR_WHITE);
GameTextForPlayer(playerid, "~y~Player Arrested~n~+3000$", 3500, 3);
GameTextForPlayer(id, "~r~You have been arrested~n~-3000$", 3500, 3);
GivePlayerMoney(id, -3000);
GivePlayerMoney(playerid, 3000);
SetPlayerPos(id, 2340.2749,2457.5000,14.968;
}
}
else
{
SendClientMessage(playerid, 0xFF0000AA, "You are not a Cop to use this, or there is no arrestable player nearby.");
}
}
else
{
SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/arrest <playerid>\"");
}
return 1;
}
How Can i add timer to this command?
{
if (strlen(params))
{
id = strval(params);
if (IsPlayerConnected(id) && (gTeam[playerid] != TEAM_HEAL) && (gTeam[playerid] != TEAM_CIVIL) && (GetDistanceBetweenPlayers( playerid, id) < 5.0 ) && (GetPlayerWantedLevel(id) >= 4) && (gTeam[id] != TEAM_COPS) && (gTeam[id] != TEAM_CIA))
{
if(GetPlayerWantedLevel(id) == 4)
{
SendClientMessage(id, COLOR_RED , "You have been Arrested");
SendClientMessage(playerid, 0x00FF00AA, "Criminal arrested. Good Job!");
ResetPlayerWeapons(id);
SetPlayerHealth(id,100.0);
SetPlayerScore(playerid, GetPlayerScore( playerid ) +1 );
SetPlayerWantedLevel(id, 0);
SetPlayerColor(id,COLOR_WHITE);
GameTextForPlayer(playerid, "~y~Player Arrested~n~+1500$", 3500, 3);
GameTextForPlayer(id, "~r~You have been arrested~n~-1500$", 3500, 3);
GivePlayerMoney(id, -2000);
GivePlayerMoney(playerid, 2000);
SetPlayerPos(id, 2340.2749,2457.5000,14.968;
}
if(GetPlayerWantedLevel(id) == 5)
{
SendClientMessage(id, COLOR_RED , "You have been Arrested");
SendClientMessage(playerid, 0x00FF00AA, "Criminal arrested. Good Job!");
ResetPlayerWeapons(id);
SetPlayerHealth(id,100.0);
SetPlayerScore(playerid, GetPlayerScore( playerid ) +1 );
SetPlayerWantedLevel(id, 0);
SetPlayerColor(id,COLOR_WHITE);
GameTextForPlayer(playerid, "~y~Player Arrested~n~+2500$", 3500, 3);
GameTextForPlayer(id, "~r~You have been arrested~n~-2500$", 3500, 3);
GivePlayerMoney(id, -2500);
GivePlayerMoney(playerid, 2500);
SetPlayerPos(id, 2340.2749,2457.5000,14.968;
}
if(GetPlayerWantedLevel(id) >= 6)
{
SendClientMessage(id, COLOR_RED , "You have been Arrested");
SendClientMessage(playerid, 0x00FF00AA, "Criminal arrested. Good Job!");
ResetPlayerWeapons(id);
SetPlayerHealth(id,100.0);
SetPlayerScore(playerid, GetPlayerScore( playerid ) +1 );
SetPlayerWantedLevel(id, 0);
SetPlayerColor(id,COLOR_WHITE);
GameTextForPlayer(playerid, "~y~Player Arrested~n~+3000$", 3500, 3);
GameTextForPlayer(id, "~r~You have been arrested~n~-3000$", 3500, 3);
GivePlayerMoney(id, -3000);
GivePlayerMoney(playerid, 3000);
SetPlayerPos(id, 2340.2749,2457.5000,14.968;
}
}
else
{
SendClientMessage(playerid, 0xFF0000AA, "You are not a Cop to use this, or there is no arrestable player nearby.");
}
}
else
{
SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/arrest <playerid>\"");
}
return 1;
}
How Can i add timer to this command?