SA-MP Forums Archive
Timer. - 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: Timer. (/showthread.php?tid=640119)



Timer. - Thanks - 28.08.2017

Hello im tried to put timer 10secdons for Begin arrested but not worked Why? i've add this

At the command i add this

PHP код:
TimerArrest[targetid] = SetTimerEx("BeginArrestedTimer", 10000, false,"ui", targetid); // 10 Secdons timer
                
BeginArrested[targetid] = 1;
                
SetPlayerSpecialAction(targetid, SPECIAL_ACTION_CUFFED);
                 
SetPlayerAttachedObject(targetid, 7, 19418, 6, -0.011000, 0.028000, -0.022000, -15.600012, -33.699977, -81.700035, 0.891999, 1.000000, 1.168000);
                
ShowDescriptionText(targetid, string);
                
format(string, sizeof(string), "[BEING ARRESTED]: {FFFFFF}Law Enforcement Officer %s(%d) has put {ADFF2F}Handcuffs {FFFFFF}on you.", pName, playerid);
                
format(string, sizeof(string), "[BEING ARRESTED]: {FFFFFF}Use {0080FF}/breakcuffs (/bc) {FFFFFF}to attempt to evade the Arrest.", pName, playerid);
                
SendClientMessage(targetid, blue, string);
                
SendClientMessage(targetid, blue, string); 
Код:
public BeginArrestedTimer(playerid)
{
	if(BeginArrested[playerid] == 1)
	{
 		new pName[MAX_PLAYER_NAME],tName[MAX_PLAYER_NAME],targetid;
 		GetPlayerName(playerid, pName, sizeof(pName));
		GetPlayerName(targetid, tName, sizeof(tName));
		KillTimer(TimerArrest[targetid]);
		new Random = random(sizeof(RandomJailSpawns));
  		SetPlayerPos(targetid, RandomJailSpawns[Random][0], RandomJailSpawns[Random][1], RandomJailSpawns[Random][2]);
    	SetPlayerFacingAngle(targetid, RandomJailSpawns[Random][0]);

	}
	return 1;
}
But its not worked why?


Re: Timer. - thegamer355 - 28.08.2017

TimerArrest[targetid] = SetTimerEx("BeginArrestedTimer", 10000, false,"ui", targetid);

Why do you have "ui"? you need i only.

try this:
pawn Код:
TimerArrest[targetid] = SetTimerEx("BeginArrestedTimer", 10000, false,"i", targetid);



Re: Timer. - Thanks - 29.08.2017

I changed it but when I type /ar my friend they not giving Me timer for begin arrest How to fix it.....


Full code:

PHP код:
if(GetPlayerWantedLevel(targetid) >= 4)
            {
                new 
ArrestReward = random(50000) + 5000;
                  if(
ArrestReward > GetPlayerCash(playerid))
                  
                  
                  
TimerArrest[targetid] = SetTimerEx("BeginArrestedTimer", 10000, false,"i", targetid); // 10 Secdons timer
                
BeginArrested[targetid] = 0;
                
SetPlayerSpecialAction(targetid, SPECIAL_ACTION_CUFFED);
                 
SetPlayerAttachedObject(targetid, 7, 19418, 6, -0.011000, 0.028000, -0.022000, -15.600012, -33.699977, -81.700035, 0.891999, 1.000000, 1.168000);
                
format(string1, sizeof(string), "{0080FF}[BEING ARRESTED]: {FFFFFF}Law Enforcement Officer %s(%d) has put {ADFF2F}Handcuffs {FFFFFF}on you.", pName, playerid);
                
format(string2, sizeof(string), "{0080FF}[BEING ARRESTED]: {FFFFFF}Use {0080FF}/breakcuffs (/bc) {FFFFFF}to attempt to evade the Arrest.", pName, playerid);
                
SendClientMessage(targetid, blue, string);
                
SendClientMessage(targetid, blue, string);
                
format(string, sizeof(string), "You have placed {0080FF}%s(%d) {FFFFFF}in Handcuffs for an Arrest. Use {0080FF}/search (id) {FFFFFF}to search Him for illegal Drugs.", tName, targetid);
                
SendClientMessage(playerid, red, string);
                
                
                
format(string, sizeof(string), "{ffffff}You have Arrested {FFD700}%s(%d){FFFFFF}. You have received {33FF33}$%d {FFFFFF}for this Arrest.", tName, targetid, ArrestReward);
                
SendClientMessage(playerid, red, string);
                
ShowDescriptionText(playerid, string);
                new 
current_zone = player_zone[targetid];
                
format(string, sizeof(string), "{FFD700}%s(%d) {FFFFFF}has been {33CCFF}Arrested {FFFFFF}by {308AFF}Officer %s(%d){FFFFFF}! Location: %s", tName, targetid, pName, playerid,zones[current_zone][zone_name]);
                
SendClientMessageToAll(yellow, string);
                
format(string, sizeof(string), "~w~You have ~G~Arrested ~Y~%s(%d)~n~n~You have received ~g~$%d ~w~for this Arrest.", tName, targetid, ArrestReward);
                
GameTextForPlayer(playerid, string, 7000, 5);
                
GivePlayerMoney(playerid, ArrestReward);
                
SetPlayerScore(playerid, GetPlayerScore(playerid)+1);
                
SetPlayerScore(playerid, GetPlayerScore(targetid)-1);
                
pJailTimerID[targetid] = SetTimerEx("pJailTimer", 1000, true, "i", targetid);
                
pJailCount[targetid] = 20 + random(41);
                new 
Random = random(sizeof(RandomJailSpawns));
                
SetPlayerPos(targetid, RandomJailSpawns[Random][0], RandomJailSpawns[Random][1], RandomJailSpawns[Random][2]);
                
SetPlayerFacingAngle(targetid, RandomJailSpawns[Random][0]);
                
ResetPlayerWeapons(targetid);
                
SetPlayerInterior(targetid, 10);
                
SetPlayerWantedLevel(targetid,0);
                
SetPVarInt(playerid,"ArTime",GetTickCount()+5000);
                for(new 
i=0;i<MAX_PLAYERS;i++)
                {
                if(!
IsPlayerConnected(i))continue;
                if(
gTeam[i] == TEAM_COP)
                {
                new 
copmsg[170];
                
format(copmsg, sizeof(copmsg), "%s (%d) has arrested %s (%d)",pName,playerid,tName,targetid);
                
SendClientMessage(i, COLOR_BLUE, copmsg);
                }
              }
            }
        }
    return 
1;
} 



Re: Timer. - Thanks - 29.08.2017

anyone.


Re: Timer. - thegamer355 - 29.08.2017

Don't bump your topic within 24 hours, you even did it within 20 minutes.

Also:

pawn Код:
BeginArrested[targetid] = 0;
Change that 0 into a 1, as you need it to be 1 in the next part


Re: Timer. - Thanks - 29.08.2017

Quote:
Originally Posted by thegamer355
Посмотреть сообщение
Don't bump your topic within 24 hours, you even did it within 20 minutes.

Also:

pawn Код:
BeginArrested[targetid] = 0;
Change that 0 into a 1, as you need it to be 1 in the next part
ok sir i'll change it to 1 But can i ask a question? Now if i want to arrest someone they will give the player 10 secdons for /bc But after 10secdons he will goto jail?