20.11.2013, 06:20
:: MAKE SINGLE RESERVED CAR ::
Okay First You Need Put This on Your Script
Next on public OnFilterScriptInit() Do Like That
Then on public OnPlayerStateChange(playerid, newstate, oldstate) :
Okay Now On public OnVehicleSpawn(vehicleid) . Check Your Vehicle Component on public OnFilterScriptInit()
Okay lastly Make Command To Call Your Car
This Is simple Tutorial , Hope Help You To Make Single Reserved Car
Okay First You Need Put This on Your Script
pawn Code:
#define FILTERSCRIPT
#define COLOR_RED 0xAA3333AA// your can change your own color
#include <a_samp>
new Awankz; //Change Your own Name
pawn Code:
Awankz = AddStaticVehicle(X,Y,Z,angle,COLOR1,COLOR2);
ChangeVehiclePaintjob(Awankz,0); // Vehicle Paintjob
AddVehicleComponent(Awankz, 1036); // Vechicle Component *Your can more Vehicle Component
return 1;
}
pawn Code:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
new PlayerName[24];
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
if(newstate == PLAYER_STATE_DRIVER) {
new Vehicle = GetPlayerVehicleID(playerid);
if(Vehicle == Awankz) { // Check Your Name
if(strcmp(PlayerName,"Awankz",true)) { //Check Your Name
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, 0xF3764BC8, ":: This Car Is Reserved For Awankz ::"); // Change To Your own Name
}
}
}
return 1;
}
pawn Code:
public OnVehicleSpawn(vehicleid)
{
ChangeVehiclePaintjob(Awankz,0);
AddVehicleComponent(Awankz, 1036);
return 1;
}
pawn Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
//Command Start Here
if (strcmp("/mycar", cmdtext, true, 10) == 0)
{
if(IsPlayerConnected(playerid))
{
new Name[MAX_PLAYER_NAME];
GetPlayerName(playerid,Name,sizeof(Name));
if(!strcmp(Name, "Awankz", true)) //Check Your Name
{
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
SetVehiclePos(1, X, Y, Z); //1 = vehicleid. || X = Position X || Y = Position Y || Z = Position Z.
PutPlayerInVehicle(playerid, 1, 0); //1 = vehicleid || 0 = State(0 = Driver)
}
}
return 1;
}
//Command Finish Here
return 0;
}