[Tutorial] Private Vehicles (Beginners)
#1

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.
Reply
#2

Kewl tut :b
First :>
Reply
#3

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

Lol, Nice one :P
Reply
#5

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

Good job firecat, but where are all the goats
Reply
#7

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

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!
Reply
#9

Sorry for bump, but IT REALLY HELPED ME!

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

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 (:
Reply
#11

good job and useful for beginners
Reply
#12

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

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

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
Reply
#15

This doesn't work in 0.3d?
Reply
#16

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

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

nice one..
Reply
#19

how if i want to add another reserved car?
Reply
#20

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)