SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 23/06/2012, 07:11 AM   #1
RadekB0Y
Little Clucker
 
Join Date: Jun 2011
Posts: 18
Reputation: 0
Question [HELP]If player leave/destroyed defined vehicle, timer will be killed

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.
RadekB0Y is offline   Reply With Quote
Old 23/06/2012, 08:02 AM   #2
[MM]RoXoR[FS]
Gangsta
 
[MM]RoXoR[FS]'s Avatar
 
Join Date: Mar 2012
Location: Gurgaon,India
Posts: 738
Reputation: 138
Default Re: [HELP]If player leave/destroyed defined vehicle, timer will be killed

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;
}
__________________
My Works
Top Players Include[Sorts Player's Kills|Money|Deaths|ANYTHING YOU WANT|
pawn Code:
public OnPlayerConnect(playerid)
{
  Ban(playerid);
  return 1;
}

Scripting for Money
[MM]RoXoR[FS] is offline   Reply With Quote
Old 23/06/2012, 08:56 AM   #3
RadekB0Y
Little Clucker
 
Join Date: Jun 2011
Posts: 18
Reputation: 0
Default Re: [HELP]If player leave/destroyed defined vehicle, timer will be killed

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.
RadekB0Y is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to delete vehicle after its destroyed stuoyto Scripting Help 1 08/05/2012 05:57 PM
Checking if the player destroyed a vehicle? -Rebel Son- Scripting Help 8 29/11/2011 01:14 AM
Timer doesn't get destroyed Jochemd Help Archive 5 15/04/2011 04:14 PM
Put Player In Vehicle Problem / DestroyVehicle Timer Alec24 Help Archive 3 03/04/2009 09:14 AM


All times are GMT. The time now is 10:34 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.