SA-MP Forums Archive
Vip Car Help - 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: Vip Car Help (/showthread.php?tid=286571)



Vip Car Help - Salsa - 29.09.2011

i need help with VIP car i save a car at a place now i want it for only vips how when any player trying to take vip car A Message show on player screen YOU NEED TO BE VIP LEVEL 2 TO TAKE THIS CAR

Code:
AddStaticVehicle(561,2170.4277,1973.5856,10.6340,88.5622,1,255); //



Re: Vip Car Help - iPLEOMAX - 29.09.2011

pawn Code:
//Global - On top of script
new VIP_CAR1;

//GameModeInit
VIP_CAR1 = AddStaticVehicle(561,2170.4277,1973.5856,10.6340,88.5622,1,255);

public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER && GetPlayerVehicleID(playerid) == VIP_CAR1)
{
if(pInfo[playerid][VIPLevel] < 2)
{
SendClientMessage(playerid, 0xFF0000FF, "You need to be VIP Member (Level 2) to use this vehicle.");
RemovePlayerFromVehicle(playerid);
}
}
return 1;
}
Untested.

Sorry for the bad indentation, can't be bothered about that right now.


Re: Vip Car Help - Salsa - 29.09.2011

actually i am using 0Admin so plz edit it for 0Admin can i put it on 0Admin

Example of one 0Admin command
==>
Code:
CMD:cargod(PARAMS)
{
    LoginCheck(playerid);
    LevelCheck(playerid, 1);

	switch(P_DATA[playerid][CarGod])
	{
	    case false:
	    {
	        P_DATA[playerid][CarGod] = 1;
			SetPVarInt(playerid, "0_CarGod", 1);
	        SendClientMessage(playerid, Color:GREY, "Vehicle God has been activated!");
		}
		case true:
		{
		    P_DATA[playerid][CarGod] = 0;
		    SetPVarInt(playerid, "0_CarGod", 0);
	        SendClientMessage(playerid, Color:GREY, "Vehicle God has been deactivated!");

		}
	}
	return 1;
}



Re: Vip Car Help - Kingunit - 29.09.2011

pawn Code:
//Global - On top of script
new VIP_CAR1;

//GameModeInit
VIP_CAR1 = AddStaticVehicle(561,2170.4277,1973.5856,10.6340,88.5622,1,255);

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER && GetPlayerVehicleID(playerid) == VIP_CAR1)
    {
        if(pInfo[playerid][VIPLevel] < 2)
        {
            SendClientMessage(playerid, 0xFF0000FF, "You need to be VIP Member (Level 2) to use this vehicle.");
            RemovePlayerFromVehicle(playerid);
        }
    }
    return 1;
}

// Code from iPLEOMAX



Re : Vip Car Help - Amine_Mejrhirrou - 14.05.2012

is it posible to do something like
Code:
new vipcars;


///////////////
	vipcars = CreateVehicle(415, 2541.9836, 2373.1616, 4.2078, 90.0000, -1, -1, 10000);
	vipcars = CreateVehicle(494, 2542.0288, 2369.3257, 4.2078, 90.0000, -1, -1, 10000);
	vipcars = CreateVehicle(601, 2525.2507, 2364.4233, 4.2071, 90.0000, -1, -1, 10000);
	vipcars = CreateVehicle(601, 2525.2004, 2368.7664, 4.2071, 90.0000, -1, -1, 10000);
	vipcars = CreateVehicle(601, 2525.7378, 2372.9229, 4.2071, 90.0000, -1, -1, 10000);
	vipcars = CreateVehicle(601, 2525.3804, 2376.8618, 4.2071, 90.0000, -1, -1, 10000);
	vipcars = CreateVehicle(601, 2525.5127, 2381.3167, 4.2071, 90.0000, -1, -1, 10000);
	vipcars = CreateVehicle(568, 2515.0525, 2363.9822, 4.5085, 90.0000, -1, -1, 10000);
	vipcars = CreateVehicle(495, 2516.2449, 2382.1934, 4.5085, 90.0000, -1, -1, 10000);
	vipcars = CreateVehicle(444, 2516.2219, 2377.1284, 4.5085, 90.0000, -1, -1, 10000);
	vipcars = CreateVehicle(557, 2515.5313, 2372.4619, 4.5085, 90.0000, -1, -1, 10000);
	vipcars = CreateVehicle(424, 2514.8418, 2368.2844, 4.5085, 90.0000, -1, -1, 10000);
	vipcars = CreateVehicle(447, 2494.1953, 2398.8889, 71.5000, 0.0000, -1, -1, 10000);
	vipcars = CreateVehicle(488, 2494.1772, 2387.4556, 71.5327, 0.0000, -1, -1, 10000);
	vipcars = CreateVehicle(476, 2477.7434, 2355.8086, 71.5000, 0.0000, -1, -1, 10000);
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER && GetPlayerVehicleID(playerid) == VIP_CAR1)
    {
        if(pInfo[playerid][VIPLevel] < 2)
        {
            SendClientMessage(playerid, 0xFF0000FF, "You need to be VIP Member (Level 2) to use this vehicle.");
            RemovePlayerFromVehicle(playerid);
        }
    }
    return 1;
}
just to avoid to put vipcar1 vipcar2 vipcar3 ...


Re: Vip Car Help - Ballu Miaa - 14.05.2012

You can do this
pawn Code:
new vipcars[14];

// Under OnGameModeInIt

vipcars = CreateVehicle(415, 2541.9836, 2373.1616, 4.2078, 90.0000, -1, -1, 10000);
    vipcars[0] = CreateVehicle(494, 2542.0288, 2369.3257, 4.2078, 90.0000, -1, -1, 10000);
    vipcars[1] = CreateVehicle(601, 2525.2507, 2364.4233, 4.2071, 90.0000, -1, -1, 10000);
    vipcars[2] = CreateVehicle(601, 2525.2004, 2368.7664, 4.2071, 90.0000, -1, -1, 10000);
    vipcars[3] = CreateVehicle(601, 2525.7378, 2372.9229, 4.2071, 90.0000, -1, -1, 10000);
    vipcars[4] = CreateVehicle(601, 2525.3804, 2376.8618, 4.2071, 90.0000, -1, -1, 10000);
    vipcars[5] = CreateVehicle(601, 2525.5127, 2381.3167, 4.2071, 90.0000, -1, -1, 10000);
    vipcars[6] = CreateVehicle(568, 2515.0525, 2363.9822, 4.5085, 90.0000, -1, -1, 10000);
    vipcars[7] = CreateVehicle(495, 2516.2449, 2382.1934, 4.5085, 90.0000, -1, -1, 10000);
    vipcars[8] = CreateVehicle(444, 2516.2219, 2377.1284, 4.5085, 90.0000, -1, -1, 10000);
    vipcars[9] = CreateVehicle(557, 2515.5313, 2372.4619, 4.5085, 90.0000, -1, -1, 10000);
    vipcars[10] = CreateVehicle(424, 2514.8418, 2368.2844, 4.5085, 90.0000, -1, -1, 10000);
    vipcars[11] = CreateVehicle(447, 2494.1953, 2398.8889, 71.5000, 0.0000, -1, -1, 10000);
    vipcars[12] = CreateVehicle(488, 2494.1772, 2387.4556, 71.5327, 0.0000, -1, -1, 10000);
    vipcars[13] = CreateVehicle(476, 2477.7434, 2355.8086, 71.5000, 0.0000, -1, -1, 10000);



Re : Vip Car Help - Amine_Mejrhirrou - 14.05.2012

ok thank you (it's simpler liker that)
and for OnPlayerStateChange ir will be
if(newstate == PLAYER_STATE_DRIVER && GetPlayerVehicleID(playerid) == vipcars)
++rep by the way


Re: Re : Vip Car Help - Ballu Miaa - 14.05.2012

Quote:
Originally Posted by Amine_Mejrhirrou
View Post
ok thank you (it's simpler liker that)
and for OnPlayerStateChange ir will be
if(newstate == PLAYER_STATE_DRIVER && GetPlayerVehicleID(playerid) == vipcars)
++rep by the way
Haha Thanks for the 100th Rep Point.


Re : Vip Car Help - Amine_Mejrhirrou - 14.05.2012

not working when i do that
Code:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if(vehicleid == vipcars[]) {
		new file[128];
		format(file, sizeof(file), USER_FILE, GetPName(playerid));
		if(dini_Int(file, "VIP")< 1){
            RemovePlayerFromVehicle(playerid);
            SendClientMessage(playerid,YELLOW,"Not Vip");
		}
    }
    return 1;
}