SA-MP Forums Archive
[Tutorial] Private Vehicles (Beginners) - 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: Tutorials (https://sampforum.blast.hk/forumdisplay.php?fid=70)
+---- Thread: [Tutorial] Private Vehicles (Beginners) (/showthread.php?tid=283929)

Pages: 1 2


Private Vehicles (Beginners) - FireCat - 17.09.2011

Hello :b
I'm going to show you how to make private vehicles, but a beginners version.

So lets start of with the variables.
pawn Code:
new FireCat;
So that's going to be my 'name', i'll be the owner of the vehicle.
That's aswell where we are going to store the 'vehicle id'.
So now under OnGameModeInit

pawn Code:
FireCat = CreateVehicle(411,0,0,0,1,146,146,60);
So the variable FireCat will store the vehicle id.
CreateVehicle params are:
-model id
-Float: Spawn X
-Float: Spawn Y
-Float: Spawn Z
-Float: Angle
-Color 1
-Color 2
-Respawn delay in seconds
Now lets make only the selected play can drive the vehicle.
So under OnPlayerEnterVehicle add
pawn Code:
if(vehicleid == FireCat)//Checking if the vehicleid matches the FireCat one.
{
new pName[MAX_PLAYER_NAME];//Where we will store the players name in a 24 size.
GetPlayerName(playerid,pName,sizeof(pName));//Getting the players name and storing it in pName.
if(strcmp(pName,"NAMEHERE") == 0)//String compare between the users name and the selected name.
{
//If the 2 names are the same...
SendClientMessage(playerid,-1,"Welcome to your car!");
}
else//Else if the 2 names don't match....
{  
RemovePlayerFromVehicle(playerid);//Lets remove him from the vehicle
SendClientMessage(playerid,-1,"This car is not yours!");
}
}
I hope you liked it.
If I didn't explain well enough, don't complain, just ask for me to explain better.


Re: Private Vehicles (Beginners) - [MWR]Blood - 17.09.2011

Kewl tut :b
First :>


Re: Private Vehicles (Beginners) - FireCat - 17.09.2011

Quote:
Originally Posted by [MWR]Blood
View Post
Kewl tut :b
First :>
Lawl thanks :b
Den u sawck. :>


Re: Private Vehicles (Beginners) - =WoR=G4M3Ov3r - 17.09.2011

Lol, Nice one :P


Re: Private Vehicles (Beginners) - FireCat - 17.09.2011

Quote:
Originally Posted by G4M3Ov3r
View Post
Lol, Nice one :P
Thank you, screen licker.


Re: Private Vehicles (Beginners) - Max_Coldheart - 17.09.2011

Good job firecat, but where are all the goats


Re: Private Vehicles (Beginners) - System64 - 17.09.2011

lol what is this
https://sampforum.blast.hk/showthread.php?tid=283896


Re: Private Vehicles (Beginners) - FireCat - 17.09.2011

Quote:
Originally Posted by Max_Coldheart
View Post
Good job firecat, but where are all the goats
I guess they are sleeping in dugi's pijama party.
Quote:
Originally Posted by System64
View Post
Zomg. I didn't see that. Ouch!


Re: Private Vehicles (Beginners) - [GOD]Dragonster82 - 04.10.2011

Sorry for bump, but IT REALLY HELPED ME!

Thank you SOOO much! Helped me with my private classes.


Re: Private Vehicles (Beginners) - FireCat - 04.10.2011

Quote:
Originally Posted by [GOD]Dragonster82
View Post
Sorry for bump, but IT REALLY HELPED ME!

Thank you SOOO much! Helped me with my private classes.
No problem, I'm glad I helped (:


Re: Private Vehicles (Beginners) - Tigerkiller - 04.10.2011

good job and useful for beginners


Re: Private Vehicles (Beginners) - Hyldran - 25.10.2011

Do i create new Pawno File or add it in a gamemode or what ?


Re: Private Vehicles (Beginners) - FireCat - 25.10.2011

Quote:
Originally Posted by Hyldran
Посмотреть сообщение
Do i create new Pawno File or add it in a gamemode or what ?
What ever...


Re: Private Vehicles (Beginners) - Hyldran - 25.10.2011

what ever ? :P
I make a new script, add the file in filterscript folder and then compile it?
then in server.cfg i write the name of the script in the line?? :O


Re: Private Vehicles (Beginners) - stuntmania - 07.12.2011

This doesn't work in 0.3d?


Re: Private Vehicles (Beginners) - FireCat - 07.12.2011

Quote:
Originally Posted by stuntmania
Посмотреть сообщение
This doesn't work in 0.3d?
I think it does (;


Re: Private Vehicles (Beginners) - stuntmania - 09.12.2011

Quote:
Originally Posted by FireCat
Посмотреть сообщение
I think it does (;
Not for me


Re: Private Vehicles (Beginners) - SupremeCommander - 09.12.2011

nice one..


Re: Private Vehicles (Beginners) - adios1 - 10.12.2011

how if i want to add another reserved car?


Re: Private Vehicles (Beginners) - titanak - 18.12.2011

if the vehicle: FireCat is destroyed like with: DestroyVehicle(FireCat); it will be bugged when someone enters to any vehicle it will send you RemovePlayerFromVehicle(playerid); ... just warning you.