Help with 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: Help with timer (
/showthread.php?tid=539760)
Help with timer -
YanLanger - 30.09.2014
Hello, I created /arrest (or /ar whatever..)
And when i /arrest someone he sent to jail, I need jail timer, let's say.. ahuymm 200 seconds
And i tried to ****** lol.
oh and make it sortof a tutorial so i will learn from it .
Re: Help with timer -
SilentSoul - 30.09.2014
https://sampwiki.blast.hk/wiki/SetTimerEx
Example:
pawn Код:
CMD:arrest(playerid,params[])
{
new time;
SetTimerEx("UnjailTimer",time*1000,"i",playerid);//Note use time*1000 only if you're using per seconds if you want only 200 seconds use 200000 instead of time*1000
return 1;
}
//Later usage
forward UnjailTime(playerid);
public UnjailTime(playerid)
{
//Unjail him by using SpawnPlayer(playerid);, however you can either set his postion
}
Re: Help with timer -
YanLanger - 30.09.2014
--REMOVD--
So no one will copy my cmd.
Respuesta: Re: Help with timer -
!R1Ch@rD! - 30.09.2014
pawn Код:
CMD:arrest(playerid,params[])
{
new targetid, str[512];
if(IsPlayerPolice[playerid] < 1) return SendClientMessage(playerid,-1,"{ff0000}This command only for cops");
if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, -1,"USAGE: /arrest [Part of Name/Player ID]");
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, 0xFFFFFFF,"ERROR: This player is not connected!");
if(playerid == 0) return SendClientMessage(playerid, 0xFFFFFFF, "ERROR: You can't arrest yo self lmao");
new target[MAX_PLAYER_NAME];
GetPlayerName(targetid, target, sizeof(target));
format(str, sizeof(str), "{ff0000}You have arrested %s",target);
SendClientMessage(playerid, 0xE01B1B, str);
GameTextForPlayer(playerid, "ARRESTED",5000,2);
SendClientMessageToAll(-1, "%s Has been sent to jail");
SetPlayerInterior(playerid, 6);
ResetPlayerWeapons(playerid);
SetTimerEx("UnjailTimer",1000,0,"i",targetid);
return 1;
}
see if it works there
Re: Help with timer -
YanLanger - 30.09.2014
warning 203: symbol is never used: "time"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
Re: Help with timer -
Ox1gEN - 30.09.2014
Then you haven't used a symbol named time, just remove that.
You know that when errors like this come up.. They are pretty self explanatory.
Re: Help with timer -
YanLanger - 30.09.2014
ty lol
Respuesta: Re: Help with timer -
!R1Ch@rD! - 30.09.2014
Quote:
Originally Posted by YanLanger
warning 203: symbol is never used: "time"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
|
deleted time
so it is no time
Re: Help with timer -
YanLanger - 30.09.2014
When the player released? 200 seconds ye ?
Respuesta: Re: Help with timer -
!R1Ch@rD! - 30.09.2014
Quote:
Originally Posted by YanLanger
When the player released? 200 seconds ye ?
|
you want the player is released in 200 second?
or want to stay in jail 200 seconds?
switch to the second you want