SetTimerEx for object? - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: SetTimerEx for object? (
/showthread.php?tid=171263)
SetTimerEx for object? -
Sascha - 25.08.2010
Hi..
I want to make a something which moves several objects if a player is in range of them...
first I used a timer which constantly checks the positions of all connected players..
and now I want to set a timer like: SetTimerEx("moveback", 10000, false, "i", playerid);
but for objects...
so I don't have to create timer for each object..
so I only need to know how to make the
to something like
(btw I haven't tried the last thing yet
)
Re: SetTimerEx for object? -
willsuckformoney - 25.08.2010
pawn Код:
//On the Command
SetTimerEx("moveback", 10000, false, "i", playerid);
//The Func.
forward moveback(playerid);
public moveback(playerid)
{
// do stuff here
return 1;
}
Re: SetTimerEx for object? -
Sascha - 25.08.2010
NO! lol... as I said...
I need the timer to work with object ids...
Re: SetTimerEx for object? -
Sascha - 25.08.2010
like that:
( this don't work..it doesn't move the object back -.-)
Код:
public gatecheck(objectid)
{
for(new i=0; i<MAX_PLAYERS; i++){
if(IsPlayerConnected(i)){
if(IsPlayerInRangeOfPoint(i, 8.0,1550.27575684,-1698.06298828,27.36819077) || IsPlayerInRangeOfPoint(i, 8.0,1544.19995117,-1630.96655273,12.38281250)){
if(IsPlayerInRangeOfPoint(i, 8.0, 1550.27575684,-1698.06298828,27.36819077)){
if(PlayerClass[i][police] == 1){
if(ObjectData[lspdg1][down] == 0){
MoveObject(lspdg1, 1550.27539062,-1698.06250000,12.61819077, 1.00);
SetTimerEx("moveback", 5000, false, "i", objectid);
ObjectData[lspdg1][down] = 1;
}
}
}
if(IsPlayerInRangeOfPoint(i, 8.0, 1544.19995117,-1630.96655273,12.38281250)){
if(PlayerClass[i][police] == 1){
if(ObjectData[lspdg2][down] == 0){
MoveObject(lspdg2,1544.17443848,-1623.71582031,12.38281250, 2.00);
SetTimerEx("moveback", 5000, false, "i", objectid);
ObjectData[lspdg2][down] = 1;
}
}
}
}
}
}
return 1;
}
public moveback(objectid)
{
if(objectid == lspdg1){
ObjectData[lspdg1][down] = 0;
MoveObject(lspdg1,1550.27575684,-1698.06298828,27.36819077, 1.00);
}else if(objectid == lspdg2){
ObjectData[lspdg2][down] = 0;
MoveObject(lspdg2,1544.19995117,-1630.96655273,12.38281250, 2.00);
}
return 1;
}