SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 25/01/2013, 07:15 PM   #1
se7evolution
Big Clucker
 
se7evolution's Avatar
 
Join Date: May 2012
Location: Belgium
Posts: 112
Reputation: 5
Default Destroy specific vehicle when player exit vehicle

Hello,
I am trying to create something so if player exit a vehicle Here a Brownstreak the vehicle will be destroyed.
This is my code for spawn into a Brownstreak. Never tested it because i am on my netbook. So, Should it be working?

pawn Code:
public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
    if(checkpointid == checkpointtele)
    {
        brownstreakLS = AddStaticVehicleEx (538, 1699.156494, -1953.658203, 14.875619, 82.2873, -1, -1, 1);
        PutPlayerInVehicle(playerid,brownstreakLS,0);
        SendClientMessage(playerid, 0x9370DBFF, "You have been spawned into a Train. If you exit the train it will get destroyed.");
        SendClientMessage(playerid, 0x9370DBFF, "Please enter the command /work to get a mission!");
        SetPlayerVirtualWorld(playerid, 0);
    }
    return 1;
}

Thanks,
Se7evolution
se7evolution is offline   Reply With Quote
Old 25/01/2013, 07:22 PM   #2
DrDoom151
Big Clucker
 
Join Date: Jun 2011
Posts: 65
Reputation: 4
Default Re: Destroy specific vehicle when player exit vehicle

http://wiki.sa-mp.com/wiki/AddStaticVehicleEx

Quote:
You can use this function to add vehicles to your gamemode. This function can only create vehicles in the OnGameModeInit callback, and vehicles created with this function cannot be removed. Check CreateVehicle if you are interested in creating vehicles during game-runtime.

You have to use CreateVehicle.
DrDoom151 is offline   Reply With Quote
Old 25/01/2013, 07:46 PM   #3
se7evolution
Big Clucker
 
se7evolution's Avatar
 
Join Date: May 2012
Location: Belgium
Posts: 112
Reputation: 5
Default Re: Destroy specific vehicle when player exit vehicle

What do i have to add after CreateVehicle?
Edit: The spawn doesnt work with CreateVehicle:
Code:
 Only create trains with AddStaticVehicle/Ex
se7evolution is offline   Reply With Quote
Old 25/01/2013, 07:47 PM   #4
DrDoom151
Big Clucker
 
Join Date: Jun 2011
Posts: 65
Reputation: 4
Default Re: Destroy specific vehicle when player exit vehicle

http://wiki.sa-mp.com/wiki/CreateVehicle

Quote:
(modelid, Float: x, Float: y, Float: z, Float:angle, color1, color2, respawn_delay)
In other words: exactly the same at AddStaticVehicleEx, only difference is that CreateVehicle will works whilst your gamemode is running.
DrDoom151 is offline   Reply With Quote
Old 25/01/2013, 07:47 PM   #5
MP2
Godfather
 
MP2's Avatar
 
Join Date: Jan 2011
Location: England
Posts: 6,236
Reputation: 1004
Default Re: Destroy specific vehicle when player exit vehicle

You can't create trains with CreateVehicle. You have to add them with AddStaticVehicle(Ex) at server startup.
__________________
Owner and developer of Mike's Cops and Robbers.

Click here to visit our site and find out more. Click here to view trailers.
Enter referral code SAMPFORUM after registering for a $5000 starting bonus!
MP2 is offline   Reply With Quote
Old 25/01/2013, 07:49 PM   #6
DrDoom151
Big Clucker
 
Join Date: Jun 2011
Posts: 65
Reputation: 4
Default Re: Destroy specific vehicle when player exit vehicle

Quote:
Originally Posted by MP2 View Post
You can't create trains with CreateVehicle. You have to add them with AddStaticVehicle(Ex) at server startup.
Damn, I forgot all about that.
DrDoom151 is offline   Reply With Quote
Old 25/01/2013, 07:49 PM   #7
se7evolution
Big Clucker
 
se7evolution's Avatar
 
Join Date: May 2012
Location: Belgium
Posts: 112
Reputation: 5
Default Re: Destroy specific vehicle when player exit vehicle

So what should i add to destroy the Train?
se7evolution is offline   Reply With Quote
Old 25/01/2013, 07:55 PM   #8
zde5
Little Clucker
 
Join Date: Jul 2009
Location: Croatia
Posts: 48
Reputation: 4
Default Re: Destroy specific vehicle when player exit vehicle

you can add it with AddStaticVehicleEx outside OnGameModeInit, wiki information is wrong.
zde5 is offline   Reply With Quote
Old 25/01/2013, 07:56 PM   #9
DrDoom151
Big Clucker
 
Join Date: Jun 2011
Posts: 65
Reputation: 4
Default Re: Destroy specific vehicle when player exit vehicle

You have to add trains using AddStaticVehicle(Ex), but you can't delete it.
DrDoom151 is offline   Reply With Quote
Old 25/01/2013, 08:01 PM   #10
zde5
Little Clucker
 
Join Date: Jul 2009
Location: Croatia
Posts: 48
Reputation: 4
Default Re: Destroy specific vehicle when player exit vehicle

yes you can, just tested it.
zde5 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
/vkill - destroy player vehicle kbalor Scripting Help 0 08/08/2012 06:07 PM
Onplayer exit specific vehicle[help] -•♥♠♦♣-•Arshavin•-♥♠♦♣•- Help Archive 3 05/02/2011 04:23 AM
[Help] Player Cant Exit Vehicle Niixie Help Archive 4 26/02/2010 02:54 PM
How can i spawn a specific player in a specific vehicle ? AlbanianGuy Help Archive 8 16/01/2010 07:31 AM
[Solved]Removing player from a specific vehicle. ReV. Help Archive 4 26/04/2009 03:05 PM


All times are GMT. The time now is 11:05 PM.


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