[Tutorial] Create a personnal car
#1

Hey guys today i'm going to show u how to make personal cars
Step 1 : Create a new pawno file and delete all content xD
Step 2 : Add at the top
Code:
#include <a_samp>
Step 3 : Under this write
Code:
new privatecars;
// You should have :
Code:
#include <a_samp> 

new privatecars;
Step 4 : Go to "OnGameModeInit ()" and put a single name space, after that a draw and add vehicle space and the position

Template :
Code:
privatecars = AddStaticVehicle(vmodel, Float X, Float Y, Float Z, Rotation, Colour 1, Colour 2)
Example :
Code:
privatecars = AddStaticVehicle(411, 248.2920000, -1801.4291000, 4.4594000, 0.0000000, 3, 3)
// You should have this :
Code:
public OnGameModeInit() 
{ 
        privatecars = AddStaticVehicle(411, 248.2920000, -1801.4291000, 4.4594000, 0.0000000, 3, 3) 
        return 1; 
}
// Now we going to make the vehicle personal
Step 5 : Now Move to public OnPlayerStateChange()
Step 6 : Write this :
Code:
1)public OnPlayerStateChange(playerid, newstate, oldstate) 
2){ 
3)    if(newstate == PLAYER_STATE_DRIVER && GetPlayerVehicleID(playerid) == privatecars) 
4)    { 
5)        new name[MAX_PLAYER_NAME]; 
6)        GetPlayerName(playerid, name, sizeof(name)); 
7)        if(strcmp(name, "", false)) 
8)        { 
9)            RemovePlayerFromVehicle(playerid); 
10)            SendClientMessage(playerid, 0x281aeb, "This vehicle doesn't belong to "); 
11)        } 
12)    } 
13)    return 1; 
}
Step 8 : At the ling 7 write the EXACT name (in samp) of the car owner

Code:
public OnPlayerStateChange(playerid, newstate, oldstate) 
{ 
    if(newstate == PLAYER_STATE_DRIVER && GetPlayerVehicleID(playerid) == privatecars) 
    { 
        new name[MAX_PLAYER_NAME]; 
        GetPlayerName(playerid, name, sizeof(name)); 
        if(strcmp(name, "1Geek", false)) 
        { 
            RemovePlayerFromVehicle(playerid); 
            SendClientMessage(playerid, 0x281aeb, "This vehicle doesn't belong to 1Geek"); 
        } 
    } 
    return 1; 
}
// FINAL CODE FOR YOU GUYS

Code:
#include <a_samp> 
new privatecars; 
public OnGameModeInit() 
{ 
    privatecars = AddStaticVehicle(411, 248.2920000, -1801.4291000, 4.4594000, 0.0000000, 3, 3); 
    return 1; 
} 
public OnPlayerStateChange(playerid, newstate, oldstate) 
{ 
    if(newstate == PLAYER_STATE_DRIVER && GetPlayerVehicleID(playerid) == privatecars) 
    { 
        new name[MAX_PLAYER_NAME]; 
        GetPlayerName(playerid, name, sizeof(name)); 
        if(strcmp(name, "Bizza", false)) 
        { 
            RemovePlayerFromVehicle(playerid); 
            SendClientMessage(playerid, 0x281aeb, "This vehicle doesn't belong to you"); 
        } 
    } 
    return 1; 
}
Then Press F5 or Compile and Enjoy your private car.

// You can make a teleport to this car >>

Write this @ OnPlayerCommandText

Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/pcar1", true))
    {
        SetPlayerPos(playerid, 248.2920000, -1801.4291000, 4.4594000);
        return 1;
    }
    return 0;
}
Hope i helped more than one
Reply


Messages In This Thread
Create a personnal car - by 1Geek - 14.08.2013, 19:59
Re: Create a personnal car - by verlaj - 15.08.2013, 06:18
Re: Create a personnal car - by Matnix - 15.08.2013, 08:00
Re : Re: Create a personnal car - by 1Geek - 15.08.2013, 14:42
Re : Re: Create a personnal car - by 1Geek - 15.08.2013, 14:44
Re: Create a personnal car - by gtakillerIV - 15.08.2013, 15:00
Re: Create a personnal car - by 69ProFeSSioNaL69 - 19.08.2013, 11:59
Re: Create a personnal car - by radiobizza - 31.08.2013, 06:21

Forum Jump:


Users browsing this thread: 1 Guest(s)