[Tutorial] Private cars
#1

[Tutorial]How to create a private cars



In this tutorial I will show you how to create a personal car

P.S: No one can enter the vehicle. NOBODY

1) First create the unique name

PHP код:
#include <a_samp>
//the rest includes
new privatecars
2) Go to "OnGameModeInit ()" and put a single name space, after that a draw and add vehicle space and the position

PS: The car must position x, y, z, rx, ry, rz

PHP код:
public OnGameModeInit()
{
        
privatecars AddStaticVehicle(411248.2920000, -1801.42910004.45940000.000000033)
        return 
1;

P.S: the 2 to 3 are the colors of the vehicle

If you want to change it visit the site for more game

3)Now I will give you a script that will put it to "OnPlayerStateChange" and you change the name on car owner

PHP код:
1)public OnPlayerStateChange(playeridnewstateoldstate)
2){
3)    if(newstate == PLAYER_STATE_DRIVER && GetPlayerVehicleID(playerid) == privatecars)
4)    {
5)        new name[MAX_PLAYER_NAME];
6)        GetPlayerName(playeridnamesizeof(name));
7)        if(strcmp(name""false))
8)        {
9)            RemovePlayerFromVehicle(playerid);
10)            SendClientMessage(playerid0x281aeb"This vehicle doesn't belong to you");
11)        }
12)    }
13)    return 1;

Now turn 7 where are 2 quotes put the exact name of the owner

Now you should look like

PHP код:
public OnPlayerStateChange(playeridnewstateoldstate)
{
    if(
newstate == PLAYER_STATE_DRIVER && GetPlayerVehicleID(playerid) == privatecars)
    {
        new 
name[MAX_PLAYER_NAME];
        
GetPlayerName(playeridnamesizeof(name));
        if(
strcmp(name"Bizza"false))
        {
            
RemovePlayerFromVehicle(playerid);
            
SendClientMessage(playerid0x281aeb"This vehicle doesn't belong to you");
        }
    }
    return 
1;

Now all you have done would need to look like

PHP код:
#include <a_samp>
new privatecars;
public 
OnGameModeInit()
{
    
privatecars AddStaticVehicle(411248.2920000, -1801.42910004.45940000.000000033);
    return 
1;
}
public 
OnPlayerStateChange(playeridnewstateoldstate)
{
    if(
newstate == PLAYER_STATE_DRIVER && GetPlayerVehicleID(playerid) == privatecars)
    {
        new 
name[MAX_PLAYER_NAME];
        
GetPlayerName(playeridnamesizeof(name));
        if(
strcmp(name"Bizza"false))
        {
            
RemovePlayerFromVehicle(playerid);
            
SendClientMessage(playerid0x281aeb"This vehicle doesn't belong to you");
        }
    }
    return 
1;

I hope this tutorial helped you

Contact

YahooMessenger:radiobizza@yahoo.com

Skype:gabitza12321



My Work



[Tutorial]Private Cars
Reply
#2

Folositor.. multumim.

+REP
Reply
#3

Can you make a small text? :3
Reply
#4

good..it helped me a lot...tnx bro
Reply
#5

Quote:
Originally Posted by ajam123
Посмотреть сообщение
Can you make a small text? :3
k man
Reply
#6

First of all, wrong section and you've explained nothing on the OnPlayerStateChange callback.
Reply
#7

ty i`ll test it later
Reply
#8

Nice Tutorial .
Reply
#9

Wrong section btw.. a tutorial MUST explain every single thing in it
Reply
#10

You didn't explained anything in this tutorial. I have created one that could be understand by any newbie:https://sampforum.blast.hk/showthread.php?tid=406309
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)