PDA

View Full Version : How to make vehicles for vips?


maikel saliba
28/08/2011, 10:41 PM
Hello, i want to make vehicles for vips, so only vips can enter it, how do i do that?

knackworst
28/08/2011, 10:50 PM
First of all u need a variable to make a player a vip:
new VIP[MAX_PLAYERS];
add this on top of your FS/GM
under the defines

then add this under OnPlayerCommandText:
if (strcmp("/makemevip", cmdtext, true, 10) == 0)
{
SendClientMessage(playerid, COLOR_SEXYGREEN, "You are now VIP!");
VIP[playerid] == 1;
return 1;
}

NOTE the example is not advanced, u can always make urself vip even if u are already one... but that's not the intention for this example...

Then under OnPlayerStateCHange
add this:
if(newstate == 2)
{
if(VIP[playerid] == 1)
{
new vehicle;
vehicle = GetVehicleModel(GetPlayerVehicleID(playerid));
if(vehicle == 300 || vehicle == 400 || vehicle == 500) //change the numbers to the car ID u want the vip to be able to enter
{
SendClientMessage(playerid, COLOR_SEXYGREEN, "U entered a VIP vehicle");
}
}
else if(VIP[playerid] == 0)
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_RED, "U need to be a VIP for this vehicle!");
}
}

so ur script should look a lil like this:
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT

#include <a_samp>

#define COLOR_RED 0xFF0000AA
#define COLOR_SEXYGREEN 0x00FF00FF

new VIP[MAX_PLAYERS];

#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Blank Filterscript by your name here");
print("--------------------------------------\n");
return 1;
}

public OnFilterScriptExit()
{
return 1;
}

#else

main()
{
print("\n----------------------------------");
print(" Blank Gamemode by your name here");
print("----------------------------------\n");
}

#endif

public OnGameModeInit()
{
// Don't use these lines if it's a filterscript
SetGameModeText("Blank Script");
AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
return 1;
}

public OnGameModeExit()
{
return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/makemevip", cmdtext, true, 10) == 0)
{
SendClientMessage(playerid, COLOR_SEXYGREEN, "You are now VIP!");
VIP[playerid] = 1;
return 1;
}
return 0;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == 2)
{
if(VIP[playerid] == 1)
{
new vehicle;
vehicle = GetVehicleModel(GetPlayerVehicleID(playerid));
if(vehicle == 300 || vehicle == 400 || vehicle == 500) //change the numbers to the car ID u want the vip to be able to enter
{
SendClientMessage(playerid, COLOR_SEXYGREEN, "U entered a VIP vehicle");
}
}
else if(VIP[playerid] == 0)
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_RED, "U need to be a VIP for this vehicle!");
}
}
return 1;
}

qUick1337
28/08/2011, 10:50 PM
if(newcar == OLDCAR || newcar == OLDCAR)
{
if(PlayerInfo[playerid][pVip] == 1){ }
else
{
SendClientMessage(playerid,COLOR_GREY," You are not a VIP !");
RemovePlayerFromVehicle(playerid);
}
}

That should work if you have a VIP System :D Change OLDCAR and PlayerInfo[playerid][pVip]

maikel saliba
28/08/2011, 11:16 PM
First of all u need a variable to make a player a vip:
new VIP[MAX_PLAYERS];
add this on top of your FS/GM
under the defines

then add this under OnPlayerCommandText:
if (strcmp("/makemevip", cmdtext, true, 10) == 0)
{
SendClientMessage(playerid, COLOR_SEXYGREEN, "You are now VIP!");
VIP[playerid] == 1;
return 1;
}

NOTE the example is not advanced, u can always make urself vip even if u are already one... but that's not the intention for this example...

Then under OnPlayerStateCHange
add this:
if(newstate == 2)
{
if(VIP[playerid] == 1)
{
new vehicle;
vehicle = GetVehicleModel(GetPlayerVehicleID(playerid));
if(vehicle == 300 || vehicle == 400 || vehicle == 500) //change the numbers to the car ID u want the vip to be able to enter
{
SendClientMessage(playerid, COLOR_SEXYGREEN, "U entered a VIP vehicle");
}
}
else if(VIP[playerid] == 0)
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_RED, "U need to be a VIP for this vehicle!");
}
}

so ur script should look a lil like this:
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT

#include <a_samp>

#define COLOR_RED 0xFF0000AA
#define COLOR_SEXYGREEN 0x00FF00FF

new VIP[MAX_PLAYERS];

#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Blank Filterscript by your name here");
print("--------------------------------------\n");
return 1;
}

public OnFilterScriptExit()
{
return 1;
}

#else

main()
{
print("\n----------------------------------");
print(" Blank Gamemode by your name here");
print("----------------------------------\n");
}

#endif

public OnGameModeInit()
{
// Don't use these lines if it's a filterscript
SetGameModeText("Blank Script");
AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
return 1;
}

public OnGameModeExit()
{
return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/makemevip", cmdtext, true, 10) == 0)
{
SendClientMessage(playerid, COLOR_SEXYGREEN, "You are now VIP!");
VIP[playerid] = 1;
return 1;
}
return 0;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == 2)
{
if(VIP[playerid] == 1)
{
new vehicle;
vehicle = GetVehicleModel(GetPlayerVehicleID(playerid));
if(vehicle == 300 || vehicle == 400 || vehicle == 500) //change the numbers to the car ID u want the vip to be able to enter
{
SendClientMessage(playerid, COLOR_SEXYGREEN, "U entered a VIP vehicle");
}
}
else if(VIP[playerid] == 0)
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_RED, "U need to be a VIP for this vehicle!");
}
}
return 1;
}


I already have a command to /makevip, but if i add "if(vehicle == 300 || vehicle == 400 || vehicle == 500)" and there is a vehicle id 300 at the gym for non vips player can't enter it also?

knackworst
29/08/2011, 12:30 AM
no,
those 3 cars are only enterable for VIPS non vips can never ever enter these ones...

maikel saliba
29/08/2011, 12:33 AM
Yes but maybe i want infernus for vips and a infernus for non vips..

Davz*|*Criss
29/08/2011, 01:01 AM
Dude, You need to define Enumators top of your GM to save VIP STATUS and etc.

Knackworst code is just that you can make yourself VIP temp.

knackworst
29/08/2011, 01:08 AM
I showed him how to give permission to some players to enter a car... and the make myselfvip is an example ofc