[HELP]If player leave/destroyed defined vehicle, timer will be killed
#1

I kinda need help. I need kill timer for defined vehicle.

Example:

rhino1 = createvehicle(.......

public OnVehicleExit....
}
If vehicle is rhino1
}
Kill(rhino1timer);
return 1;
}

public OnVehicleDeath(....)
}
If vehicle is rhino1
}
KillTimer(rhino1timer);
return 1;
}
Can someone help me with this, i got 9 rhinos and i need only them to kill timer when players exits from vehicle or vehicle gets destroyed. My idea on these rhinos are: they will be available to drive only for 5 minutes, after timer expire, they will be automatically ejected and rhino will respawn. I need to check defined car (rhino1 ....) and kill timer that is for rhino1. Some help?

P.S. : I hope you guys understand this, if not ask me, i try to explain it closely.
Reply
#2

pawn Code:
new rhino[9];
new rtimer[9];
rhino[0] = CreateVehicle(....);

public OnPlayerEnterVehicle(playerid,vehicleid,ispassenger)
{
  if(vehicleid == rhino[0])
    rtimer[0] = SetTimerEx("DRhino",300000,false,"i",rhino[0]);
//And so on for other
   
}

public OnPlayerExitVehicle(playerid,vehicleid)
{
  if(vehicleid == rhino[0]
  { KillTimer(rtimer[0]);
     SetVehicleToRespawn(rhino[0]);}
//And so on for other
}
forward DRhino(id);
public DRhino(id)
{
    SetVehicleToRespawn(id);  
    return 1;
}
Reply
#3

Ok its nice, time to test it.

Just little problem was here in coding, you missed ")". But it wasnt deal.

Code:
if(vehicleid == rhino[0]) //in OnPlayerExitVehicle
Thx for help . I will tell results soon.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)