I want use a timer!
#1

I want use a 10secdons before the player goto Into jail how?


PHP код:
if(GetPlayerWantedLevel(targetid) == 100)
            {
                
TimerArrest[targetid] = SetTimerEx("BeginArrestedTimer"10000false,"i"targetid); // 10 Secdons timer
                
BeginArrested[targetid] = 1;
                
SetPlayerSpecialAction(targetidSPECIAL_ACTION_CUFFED);
                
ApplyAnimation(playerid"ped""ARRESTgun"4.101111);
                new 
ArrestReward random(15000) + 2500;
                if(
ArrestReward GetPlayerCash(playerid))
                
SetPlayerAttachedObject(targetid8194186, -0.0110000.028000, -0.022000, -15.600012, -33.699977, -81.7000350.8919991.0000001.168000);
                
format(stringsizeof(string), "{0080FF}[BEING ARRESTED]: {FFFFFF}Law Enforcement Officer %s(%d) has put {ADFF2F}Handcuffs {FFFFFF}on you."pNameplayerid);
                
format(stringsizeof(string), "You have placed {0080FF}%s(%d) {FFFFFF}in Handcuffs for an Arrest. Use {0080FF}/search (id) {FFFFFF}to search Him for illegal Drugs."tNametargetid);
                
SendClientMessage(targetid, -1"{0080FF}[BEING ARRESTED]: {FFFFFF}Use {0080FF}/breakcuffs (/bc) {FFFFFF}to attempt to evade the Arrest.");
                
format(stringsizeof(string), "{ffffff}You have Arrested {FFD700}%s(%d){FFFFFF}. You have received {33FF33}$%d {FFFFFF}for this Arrest."tNametargetidArrestReward);
                
SendClientMessage(playeridredstring);
                
format(stringsizeof(string), "{0080FF}[ARRESTED]: {FFD700}%s(%d) {FFFFFF}has been {33CCFF}Arrested {FFFFFF}by {308AFF}Officer %s(%d){FFFFFF}!"tNametargetidpNameplayerid);
                
SendClientMessageToAll(yellowstring);
                
format(stringsizeof(string), "~w~You have ~G~Arrested ~Y~%s(%d)~n~n~You have received ~n~n~~y~$%d ~w~for this Arrest."tNametargetidArrestReward);
                
GameTextForPlayer(playeridstring70005);
                
GivePlayerMoney(playeridArrestReward);
                
SetPlayerScore(playeridGetPlayerScore(playerid)+1);
                
SetPlayerScore(playeridGetPlayerScore(targetid)-1);
                
pJailTimerID[targetid] = SetTimerEx("pJailTimer"1000true"i"targetid);
                
pJailCount[targetid] = 80 random(100);
                new 
Random random(sizeof(RandomJailSpawns));
                
SetPlayerPos(targetidRandomJailSpawns[Random][0], RandomJailSpawns[Random][1], RandomJailSpawns[Random][2]);
                
SetPlayerFacingAngle(targetidRandomJailSpawns[Random][2]);
                
ResetPlayerWeapons(targetid);
                
SetPlayerColor(targetidCOLOR_WHITE);
                
SetPlayerInterior(targetid3);
                
SetPlayerWantedLevel(targetid,0);
                
SetPVarInt(playerid,"ArTime",GetTickCount()+5000);
            } 
I've trying use a timer but not work it there up TimerArrest
Reply
#2

You have
PHP код:
SetPlayerPos(targetidRandomJailSpawns[Random][0], RandomJailSpawns[Random][1], RandomJailSpawns[Random][2]); 
SetPlayerFacingAngle(targetidRandomJailSpawns[Random][2]); 
this code already in your command, this is setting target position to jail as soon as the command runs.
Reply
#3

so u already have a timer BeginArrestedTimer and is it not working or what?
Reply
#4

@Inn0cent, So how to I can use the player must have 10secdons before goto Jail? Cuffed for 10secdons then goto Into jail?

@Mugalito, I don't know if worked or not But after I arrested someone he goto Into jail faster and he is not waited 10secdons.. why
Reply
#5

so what do you actually want,a 10 second timer on /arrest or what?
Reply
#6

I want If the cop arrest someone then Don't Teleport the warrent to jail fast i want Put 10secdons before goto jail!!!
Reply
#7

try this

PHP код:
if(GetPlayerWantedLevel(targetid) == 100
            { 
                
TimerArrest[targetid] = SetTimerEx("BeginArrestedTimer"10000false,"i"targetid); // 10 Secdons timer 
                
BeginArrested[targetid] = 1
                
SetPlayerSpecialAction(targetidSPECIAL_ACTION_CUFFED); 
                
ApplyAnimation(playerid"ped""ARRESTgun"4.101111); 
                new 
ArrestReward random(15000) + 2500
                if(
ArrestReward GetPlayerCash(playerid)) 
                
SetPlayerAttachedObject(targetid8194186, -0.0110000.028000, -0.022000, -15.600012, -33.699977, -81.7000350.8919991.0000001.168000); 
                
format(stringsizeof(string), "{0080FF}[BEING ARRESTED]: {FFFFFF}Law Enforcement Officer %s(%d) has put {ADFF2F}Handcuffs {FFFFFF}on you."pNameplayerid); 
                
format(stringsizeof(string), "You have placed {0080FF}%s(%d) {FFFFFF}in Handcuffs for an Arrest. Use {0080FF}/search (id) {FFFFFF}to search Him for illegal Drugs."tNametargetid); 
                
SendClientMessage(targetid, -1"{0080FF}[BEING ARRESTED]: {FFFFFF}Use {0080FF}/breakcuffs (/bc) {FFFFFF}to attempt to evade the Arrest."); 
                
format(stringsizeof(string), "{ffffff}You have Arrested {FFD700}%s(%d){FFFFFF}. You have received {33FF33}$%d {FFFFFF}for this Arrest."tNametargetidArrestReward); 
                
SendClientMessage(playeridredstring); 
                
format(stringsizeof(string), "{0080FF}[ARRESTED]: {FFD700}%s(%d) {FFFFFF}has been {33CCFF}Arrested {FFFFFF}by {308AFF}Officer %s(%d){FFFFFF}!"tNametargetidpNameplayerid); 
                
SendClientMessageToAll(yellowstring); 
                
format(stringsizeof(string), "~w~You have ~G~Arrested ~Y~%s(%d)~n~n~You have received ~n~n~~y~$%d ~w~for this Arrest."tNametargetidArrestReward); 
                
GameTextForPlayer(playeridstring70005); 
                
GivePlayerMoney(playeridArrestReward); 
                
SetPlayerScore(playeridGetPlayerScore(playerid)+1); 
                
SetPlayerScore(playeridGetPlayerScore(targetid)-1); 
                
                
SetPVarInt(playerid,"ArTime",GetTickCount()+5000); 
            } 
forward BeginArrestedTimer(targetid);
public 
BeginArrestedTimer(targetid)
{
     
pJailTimerID[targetid] = SetTimerEx("pJailTimer"1000true"i"targetid); 
                
pJailCount[targetid] = 80 random(100); 
                new 
Random random(sizeof(RandomJailSpawns)); 
                
SetPlayerPos(targetidRandomJailSpawns[Random][0], RandomJailSpawns[Random][1], 
                
RandomJailSpawns[Random][2]); 
                
SetPlayerFacingAngle(targetidRandomJailSpawns[Random][2]); 
                
ResetPlayerWeapons(targetid); 
                
SetPlayerColor(targetidCOLOR_WHITE); 
                
SetPlayerInterior(targetid3); 
                
SetPlayerWantedLevel(targetid,0); 
     return 
1;

Reply
#8

I've got 2errors:

Код:
error 025: function heading differs from prototype
error 025: function heading differs from prototype
PHP код:
forward BeginArrestedTimer(targetid);
public 
BeginArrestedTimer(targetid
Reply
#9

Quote:
Originally Posted by RedRex
Посмотреть сообщение
I've got 2errors:

Код:
error 025: function heading differs from prototype
error 025: function heading differs from prototype
PHP код:
forward BeginArrestedTimer(targetid);
public 
BeginArrestedTimer(targetid
show me full code / function plz.
Reply
#10

PHP код:
CMD:ar(playeridparams[])
{
    new 
pName[MAX_PLAYER_NAME],tName[MAX_PLAYER_NAME],targetid,string[128];
    new 
Float:targetidpos[3];
    if(
GetPlayerSkin(playerid) == 280 && 281 && 285 && 287 && 282 && 286) return SendClientMessage(playerid, -1"{FF0000}Error: {FFFFFF}You can't ues this command.");
    if(
GetPlayerInterior(targetid) > 0) return SendClientMessage(playeridred"{FF0000}Error: {ffffff} You can't arrest players inside an interior.");
    if(
sscanf(params"ui"playerid)) SendClientMessage(playeridCOLOR_WHITE"USAGE: /ar <ID/NAME>");
    if(
GetPVarInt(playerid,"ArTime")>GetTickCount())return SendClientMessage(playerid,0xFF0000FF,"{FF0000}Error: {ffffff}Please wait 5 seconds before arresting a suspect again.");
    if(
PlayerInfo[targetid][pJailed] == 1) return SendClientMessage(playeridred"{FF0000}Error: {ffffff}This player is already in jail,you can't arrest him.");
    if(
IsPlayerInAnyVehicle(targetid)) return SendClientMessage(playerid,red,"{FF0000}Error: {ffffff}You can't arrest players if they're in a vehicle.");
    if(
GetPlayerWantedLevel(targetid) == 3) return SendClientMessage(playeridred"{FF0000}Error: {ffffff} You can't arrest players with wanted level lower than, Use /tk to issue a ticket.");
    if(
GetPlayerWantedLevel(targetid) == 0) return SendClientMessage(playeridred"{FF0000}Error: {ffffff}This player is not wanted,you can't arrest him");
    if(
playerid == targetid) return SendClientMessage(playerid,red"{FF0000}Error: {ffffff}You cannot arrest yourself.");
    if(
gTeam[playerid] == CLASS_COPS && gTeam[playerid] == CLASS_CIA && gTeam[playerid] == CLASS_SWAT && gTeam[playerid] == CLASS_ARMY) return SendClientMessage(playerid,red"You can't arrest who is in your team.");
    
GetPlayerPos(playeridtargetidpos[0], targetidpos[1], targetidpos[2]);
    if (!
IsPlayerInRangeOfPoint(playerid5.0targetidpos[0], targetidpos[1], targetidpos[2])) return SendClientMessage(playerid, -1"Nobody close enough to arrest.");
    
GetPlayerName(playeridpNamesizeof(pName));
    
GetPlayerName(targetidtNamesizeof(tName));
    if(
IsPlayerConnected(targetid))
        {
            if(
GetPlayerWantedLevel(targetid) == 100)
            {
                
TimerArrest[targetid] = SetTimerEx("BeginArrestedTimer"10000false,"i"targetid); // 10 Secdons timer
                
BeginArrested[targetid] = 1;
                
SetPlayerSpecialAction(targetidSPECIAL_ACTION_CUFFED);
                
ApplyAnimation(playerid"ped""ARRESTgun"4.101111);
                new 
ArrestReward random(15000) + 2500;
                if(
ArrestReward GetPlayerCash(playerid))
                
SetPlayerAttachedObject(targetid8194186, -0.0110000.028000, -0.022000, -15.600012, -33.699977, -81.7000350.8919991.0000001.168000);
                
format(stringsizeof(string), "{0080FF}[BEING ARRESTED]: {FFFFFF}Law Enforcement Officer %s(%d) has put {ADFF2F}Handcuffs {FFFFFF}on you."pNameplayerid);
                
format(stringsizeof(string), "You have placed {0080FF}%s(%d) {FFFFFF}in Handcuffs for an Arrest. Use {0080FF}/search (id) {FFFFFF}to search Him for illegal Drugs."tNametargetid);
                
SendClientMessage(targetid, -1"{0080FF}[BEING ARRESTED]: {FFFFFF}Use {0080FF}/breakcuffs (/bc) {FFFFFF}to attempt to evade the Arrest.");
                
format(stringsizeof(string), "{ffffff}You have Arrested {FFD700}%s(%d){FFFFFF}. You have received {33FF33}$%d {FFFFFF}for this Arrest."tNametargetidArrestReward);
                
SendClientMessage(playeridredstring);
                
format(stringsizeof(string), "{0080FF}[ARRESTED]: {FFD700}%s(%d) {FFFFFF}has been {33CCFF}Arrested {FFFFFF}by {308AFF}Officer %s(%d){FFFFFF}!"tNametargetidpNameplayerid);
                
SendClientMessageToAll(yellowstring);
                
format(stringsizeof(string), "~w~You have ~G~Arrested ~Y~%s(%d)~n~n~You have received ~n~n~~y~$%d ~w~for this Arrest."tNametargetidArrestReward);
                
GameTextForPlayer(playeridstring70005);
                
GivePlayerMoney(playeridArrestReward);
                
SetPlayerScore(playeridGetPlayerScore(playerid)+1);
                
SetPlayerScore(playeridGetPlayerScore(targetid)-1);
                
SetPVarInt(playerid,"ArTime",GetTickCount()+5000);
            }
        }
         return 
1;

Код:
forward BeginArrestedTimer(targetid);
public BeginArrestedTimer(targetid)
{
     pJailTimerID[targetid] = SetTimerEx("pJailTimer", 1000, true, "i", targetid);
     pJailCount[targetid] = 80 + random(100);
     new Random = random(sizeof(RandomJailSpawns));
     SetPlayerPos(targetid, RandomJailSpawns[Random][0], RandomJailSpawns[Random][1],
     RandomJailSpawns[Random][2]);
     SetPlayerFacingAngle(targetid, RandomJailSpawns[Random][2]);
     ResetPlayerWeapons(targetid);
     SetPlayerColor(targetid, COLOR_WHITE);
     SetPlayerInterior(targetid, 3);
     SetPlayerWantedLevel(targetid,0);
     return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)