09.01.2013, 08:42
[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(411, 248.2920000, -1801.4291000, 4.4594000, 0.0000000, 3, 3)
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(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 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(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;
}
Now all you have done would need to look like
PHP код:
#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;
}
I hope this tutorial helped you
Contact
YahooMessenger:radiobizza@yahoo.com
Skype:gabitza12321
My Work
[Tutorial]Private Cars