How To Fix This Command - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: How To Fix This Command (
/showthread.php?tid=476784)
How To Fix This Command -
Awankz - 20.11.2013
pawn Код:
dcmd_arrest(playerid,params[])
{
if((gTeam[playerid] <= 5) && (gTeam[playerid] > 0))
{
if(CopDuty[playerid] == 1)
{
if(!strlen(params)) return SendClientMessage(playerid, RED, ":: Usage: /arrest [Player Id] ::");
new player1, playername[MAX_PLAYER_NAME], copname[MAX_PLAYER_NAME], string[128];
player1 = strval(params);
if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID)
{
if(GetPlayerWantedLevel(player1) >= 1)
{
if(!IsPlayerInAnyVehicle(player1))
{
if(GetDistanceBetweenPlayers(playerid, player1) < 10)
{
GetPlayerName(player1, playername, sizeof(playername));
GetPlayerName(playerid, copname, sizeof(copname));
new jtime;
new reward;
reward = GetPlayerWantedLevel(player1);
jtime = GetPlayerWantedLevel(player1);
Info[player1][JailTime] = jtime*1000*60;
Info[player1][Jailed] = 1;
SetTimerEx("Jail1",1000,0,"d",player1);
SetTimerEx("JailPlayer",5000,0,"d",player1);
GivePlayerMoney(playerid, reward*1000);
SetPlayerWantedLevel(player1, 0);
SetPlayerScore(playerid, GetPlayerScore(playerid) +reward*5);
JailTimer[player1] = SetTimerEx("UnjailPlayer",Info[player1][JailTime],0,"d",player1);
format(string,sizeof(string),":: %s has arrested %s for %i minutes ::", copname, playername, jtime);
SendClientMessageToAll(COP_COLOR,string);
Info[playerid][Arrests]++;
new string2[256];
format(string2,sizeof(string2), ":: Congratulations, %s, you received $%i and %i score for arresting a %i-star wanted criminal! ::", copname, reward*1000, reward*5, reward);
return SendClientMessage(playerid, RED, string2);
}
else return SendClientMessage(playerid, RED, ":: ERROR: You need to be close to the player to arrest him ::");
}
else return SendClientMessage(playerid, RED, ":: ERROR: Player is in a vehicle ::");
}
else return SendClientMessage(playerid, RED, ":: ERROR: This player doesn't have 2+ stars, you can't arrest him ::");
}
else return SendClientMessage(playerid, RED, ":: ERROR: Player not found ::");
}
else return SendClientMessage(playerid, RED, ":: ERROR: You have to be on cop duty ::");
}
else return SendClientMessage(playerid, RED, ":: ERROR: You have to be a Cop to use this command ::");
}
This Command Work But I Can't Jail Wanted , This Command For Jail Wanted With A Minutes . Please Help Me How To Make This Command Work Properly
Re: How To Fix This Command -
Awankz - 02.12.2013
No One Helpp ?
Re: How To Fix This Command -
Spydah - 02.12.2013
Please explain what you want exactly.
Re: How To Fix This Command -
SilentSoul - 02.12.2013
You forget to use the function of SetPlayerPos(..); however you jail floats , also set a timer for unjail which will kill the first timer of the jail and you can use function of Spawn(playerid);
Re: How To Fix This Command -
Awankz - 19.12.2013
its work , thanks man
Re: How To Fix This Command -
operationroleplay - 19.12.2013
Ye you forgot the SetPlayerPos when he's is arrested so try SetPlayerPos(playerid, etc....)
Re: How To Fix This Command -
Awankz - 20.12.2013
yeppp