Timer help -
TouR - 07.12.2009
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?
Re: Timer help -
Blt950 - 07.12.2009
I think you got to explain a little more what it going to do. And why?
Re: Timer help -
Jeffry - 07.12.2009
Yeah, what will the command do? Do you want that you can use /arrest every 20 secs?
Re: Timer help -
TouR - 07.12.2009
Hmm ok listen... This is an arrest command... When i arrest one player i want to tele him to jail and after sometime free him automactly...
Re: Timer help -
Blt950 - 07.12.2009
Quote:
Originally Posted by tour15
Hmm ok listen... This is an arrest command... When i arrest one player i want to tele him to jail and after sometime free him automactly...
|
Okey maybe I wrote wrong. What is the timer supposed to do? Free player from jail?
Re: Timer help -
TouR - 07.12.2009
Yeah like all cops and robbers script...
Re: Timer help -
Blt950 - 07.12.2009
Just make a timer that after ## seconds/minutes set players position to the place you want the player to release.
EDIT: Make it e.g:
Код:
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.9688);
<< TIMER AT THIS LINE >>
}
Re: Timer help -
TouR - 07.12.2009
If i could do this my frined i wouldnt ask for help. Thank you for help me
Re: Timer help -
Jeffry - 07.12.2009
I will make it for you, hang on.
Re: Timer help -
TouR - 07.12.2009
Oh thank you m8. Thank you guys
Re: Timer help -
Jeffry - 07.12.2009
Okay, Put this on the end of your Script.
pawn Код:
forward arrester(playerid);
public arrester(playerid)
{
SetPlayerInterior(playerid,0);
SetPlayerPos(playerid, 0.0, 0.0, 0.0);
SpawnPlayer(playerid);
// Add anything you want...
return 1;
}
Over all the
pawn Код:
SendClientMessage(id, COLOR_RED , "You have been Arrested");
in your /arrest command
add
pawn Код:
SetTimerEx("arrester",60000,0,"is",playerid);
Hope it works! Does it?
Re: Timer help -
TouR - 07.12.2009
The SetTimerEx placed in arrest command?
Re: Timer help -
Jeffry - 07.12.2009
Over all the
pawn Код:
SendClientMessage(id, COLOR_RED , "You have been Arrested");
in your /arrest command
add
pawn Код:
SetTimerEx("arrester",60000,0,"is",playerid);
Re: Timer help -
TouR - 07.12.2009
i got this errors
C:\DOCUME~1\NIKOS\Desktop\GTASER~1\GAMEMO~1\cops.p wn(1489) : error 025: function heading differs from prototype
C:\DOCUME~1\NIKOS\Desktop\GTASER~1\GAMEMO~1\cops.p wn(1491) : error 017: undefined symbol "playerid"
C:\DOCUME~1\NIKOS\Desktop\GTASER~1\GAMEMO~1\cops.p wn(1492) : error 017: undefined symbol "playerid"
C:\DOCUME~1\NIKOS\Desktop\GTASER~1\GAMEMO~1\cops.p wn(1493) : error 017: undefined symbol "playerid"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
4 Errors.
Re: Timer help -
Jeffry - 07.12.2009
Set the playerid to id (in these lines)
Thats what you use.
Re: Timer help -
TouR - 07.12.2009
ok now i got only this
C:\DOCUME~1\NIKOS\Desktop\GTASER~1\GAMEMO~1\cops.p wn(1489) : error 025: function heading differs from prototype
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
1 Error.
Re: Timer help -
TouR - 07.12.2009
i think i made it do you want to try it to my server?
Re: Timer help -
[Marevin*] - 07.12.2009
http://pastebin.com/m316467d0
In the "SetTimerEx" replace "time" with the amount of time you want (attention: its in miliseconds)
Re: Timer help -
TouR - 07.12.2009
C:\DOCUME~1\NIKOS\Desktop\GTASER~1\GAMEMO~1\cops.p wn(1035) : error 029: invalid expression, assumed zero
C:\DOCUME~1\NIKOS\Desktop\GTASER~1\GAMEMO~1\cops.p wn(1035) : error 017: undefined symbol "d"
C:\DOCUME~1\NIKOS\Desktop\GTASER~1\GAMEMO~1\cops.p wn(1035) : error 029: invalid expression, assumed zero
C:\DOCUME~1\NIKOS\Desktop\GTASER~1\GAMEMO~1\cops.p wn(1035) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
4 Errors.
i got this
Re: Timer help -
[Marevin*] - 07.12.2009
oh sorry, in the "SetTimerEx"
instead of
replace with
with those ""