need help in reserved car system
#1

i need reserved car system please help
Reply
#2

Code:

Quote:

new DarKKingVeh;

public OnGameModeInit()
{
DarKKingVeh = CreateVehicle(411, 2109.1763, 1503.0453, 32.2887, 82.2873, 0, 1, 60); // Infernus
return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
// This is gonna teleport You to the vehicle.
if(!strcmp(cmdtext, "/MyVehicle", true))
{
SendClientMessage(playerid, 0x33AA33FF, "You're successfully teleported to Your vehicle!"); // 0x33AA33FF - Green colour
SetpPlayerPos(playerid, 2109.1763, 1503.0453, 32.288);
return 1;
}
return 0;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{

new pName[64];
GetPlayerName(playerid, pName, 64);

if(IsPlayerInVehicle(playerid, DarKKingVeh))
{
if(strcmp(pName, "DarKKing", true)) // If Player's name is not DarKKing.
{
SendClientMessage(playerid, 0xE6000000, "You're not able to enter this vehicle!"); // 0xE6000000 - Red colour.

new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
SetPlayerPos(playerid, X-3, Y, Z); // This is gonna kick Player from the vehicle id, if His/Her name is not "DarKKing".
}
}

if(IsPlayerInVehicle(playerid, DarKKingVeh))
{
if(!strcmp(pName, "DarKKing", true)) // If Player's name is DarKKing.
{
SendClientMessage(playerid, 0x33AA33FF, "You've successfully entered Your Vehicle, DarKKing!"); // 0x33AA33FF - Green colour.
}
}

return 1;
}

// TheViking
I hope this is gonna help, if not, I'm sorry.
Notify me if it works, thank You. :)
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)