28.08.2011, 22:41
Hello, i want to make vehicles for vips, so only vips can enter it, how do i do that?
new VIP[MAX_PLAYERS];
if (strcmp("/makemevip", cmdtext, true, 10) == 0) { SendClientMessage(playerid, COLOR_SEXYGREEN, "You are now VIP!"); VIP[playerid] == 1; return 1; }
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!"); } }
// 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; }
if(newcar == OLDCAR || newcar == OLDCAR) { if(PlayerInfo[playerid][pVip] == 1){ } else { SendClientMessage(playerid,COLOR_GREY," You are not a VIP !"); RemovePlayerFromVehicle(playerid); } }
First of all u need a variable to make a player a vip:
Код:
new VIP[MAX_PLAYERS]; 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; } 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!"); } } Код:
// 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; } |