SA-MP Forums Archive
How to make vehicles for vips? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: How to make vehicles for vips? (/showthread.php?tid=279767)



How to make vehicles for vips? - maikel saliba - 28.08.2011

Hello, i want to make vehicles for vips, so only vips can enter it, how do i do that?


Re: How to make vehicles for vips? - knackworst - 28.08.2011

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;
}



Re: How to make vehicles for vips? - qUick1337 - 28.08.2011

Код:
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 Change OLDCAR and PlayerInfo[playerid][pVip]


Re: How to make vehicles for vips? - maikel saliba - 28.08.2011

Quote:
Originally Posted by knackworst
Посмотреть сообщение
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?


Re: How to make vehicles for vips? - knackworst - 29.08.2011

no,
those 3 cars are only enterable for VIPS non vips can never ever enter these ones...


Re: How to make vehicles for vips? - maikel saliba - 29.08.2011

Yes but maybe i want infernus for vips and a infernus for non vips..


Re: How to make vehicles for vips? - Davz*|*Criss - 29.08.2011

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.


Re: How to make vehicles for vips? - knackworst - 29.08.2011

I showed him how to give permission to some players to enter a car... and the make myselfvip is an example ofc