Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Example filterscript: How to make a simple neon shop for your server. (Tutorial) - by Godhimself
- Release date: 22nd of July 2011.
- Link: http://forum.sa-mp.com/showthread.php?p=1305273#post1305273
- Credits:
- - <a_samp> - Credits to the samp dev team for there callbacks/functions.
- - <zcmd> - Credits to Zeex for his/her command proccessor.
- */
- #define FILTERSCRIPT
- #include <a_samp>//Credits to the samp dev team.
- #include <zcmd>//Credits to Zeex.
- //White Hex(In dialogs)
- #define WHITE_HEX {FFFFFF}
- //Colour defines(Messages)
- #define COLOUR_WHITE 0xFFFFFFAA
- #define COLOUR_RED 0xFF0000FF
- //Dialog id:
- #define NEON_DIALOG 0//You may need to change the id.
- //The neon prices:
- #define BLUE_NEONS_PRICE 10000//You may want to change this.
- #define RED_NEONS_PRICE 10000//You may want to change this.
- #define GREEN_NEONS_PRICE 10000//You may want to change this.
- #define YELLOW_NEONS_PRICE 10000//You may want to change this.
- #define PINK_NEONS_PRICE 10000//You may want to change this.
- CMD:neonshop(playerid, params[])//Rename it to w/e you like..
- {
- new string[100];//Define our string to use later when we format our neon prices into a string and show it in the dialog..
- switch(GetVehicleModel(GetPlayerVehicleID(playerid)))//Get there vehicle model and switch through each vehicle id to check if there in one of our defined vehicles..
- {
- case 562,565,559,561,560,575,534,567,536,535,576,411,579,602,496,518,527,589,597,419,
- 533,526,474,545,517,410,600,436,580,439,549,491,445,604,507,585,587,466,492,546,551,516,
- 426,547,405,409,550,566,406,540,421,529,431,438,437,420,525,552,416,433,427,490,528,
- 407,544,470,598,596,599,601,428,499,609,524,578,486,573,455,588,403,514,423,
- 414,443,515,456,422,482,530,418,572,413,440,543,583,478,554,402,542,603,475,568,504,457,
- 483,508,429,541,415,480,434,506,451,555,477,400,404,489,479,442,458,467,558://Switch through these cases and if there in one of these ids..
- {
- format(string, sizeof(string), "WHITE_HEXBlue Neons: $%d\nRed Neons: $%d\nGreen Neons: $%d\nYellow Neons: $%d\nPink Neons: $%d\nRemove Neons: Free", BLUE_NEONS_PRICE, RED_NEONS_PRICE, GREEN_NEONS_PRICE, YELLOW_NEONS_PRICE, PINK_NEONS_PRICE);//Format the string..
- ShowPlayerDialog(playerid, NEON_DIALOG, DIALOG_STYLE_LIST, "WHITE_HEXNeon Shop", string, "Select", "Cancel");//Show the neon dialog with the formatted string..
- }
- default: return SendClientMessage(playerid,COLOUR_RED,"You cannot tune this vehicle.");//Else there not in a any of our defined vehicle ids..
- }
- return true;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- switch(dialogid)//Switch through the dialog ids..
- {
- case NEON_DIALOG://For dialog id NEON_DIALOG..
- {
- if(response)//If they click something other than cancel..
- {
- switch(listitem)//Switch the list items..
- {
- case 0://If they click blue neons..
- {
- if(GetPlayerMoney(playerid) >= BLUE_NEONS_PRICE)//Check if there there holding amount is more or equal to BLUE_NEONS_PRICE if so..
- {
- SetPVarInt(playerid, "HasBlueNeons", 1);//Set there status in a player variable..
- SetPVarInt(playerid, "BlueNeons1", CreateObject(18648,0,0,0,0,0,0));//Set the neon object into a player variable..
- SetPVarInt(playerid, "BlueNeons2", CreateObject(18648,0,0,0,0,0,0));//Set the neon object into a player variable..
- AttachObjectToVehicle(GetPVarInt(playerid, "BlueNeons1"), GetPlayerVehicleID(playerid), -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);//Attatch the neon object to the vehicle(Do not change coordinates)..
- AttachObjectToVehicle(GetPVarInt(playerid, "BlueNeons2"), GetPlayerVehicleID(playerid), 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);//Attatch the neon object to the vehicle(Do not change coordinates)..
- GivePlayerMoney(playerid, - BLUE_NEONS_PRICE);//Remove the BLUE_NEONS_PRICE from the players holding amount..
- PlayerPlaySound(playerid, 1133, 0.0, 0.0, 0.0);//Play the sound that you hear when you tune a car in transfender..
- new string[80];//Define our string to use later ti format BLUE_NEONS_PRICE into a string and show it in a message..
- format(string, sizeof(string), "You have successfully added blue neons to your vehicle. Cost: $%d", BLUE_NEONS_PRICE);//Format the string..
- SendClientMessage(playerid, COLOUR_WHITE, string);//Send a client message with the formatted string..
- }
- else
- {
- SendClientMessage(playerid, COLOUR_RED,"You dont have enough money to purchase this modification.");//Else they dont have the cost of BLUE_NEONS_PRICE..
- }
- }
- case 1://If they click red neons..
- {
- if(GetPlayerMoney(playerid) >= RED_NEONS_PRICE)//Check if there there holding amount is more or equal to RED_NEONS_PRICE if so..
- {
- SetPVarInt(playerid, "HasRedNeons", 1);//Set there status in a player variable..
- SetPVarInt(playerid, "RedNeons1", CreateObject(18647,0,0,0,0,0,0));//Set the neon object into a player variable..
- SetPVarInt(playerid, "RedNeons2", CreateObject(18647,0,0,0,0,0,0));//Set the neon object into a player variable..
- AttachObjectToVehicle(GetPVarInt(playerid, "RedNeons1"), GetPlayerVehicleID(playerid), -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);//Attatch the neon object to the vehicle(Do not change coordinates)..
- AttachObjectToVehicle(GetPVarInt(playerid, "RedNeons2"), GetPlayerVehicleID(playerid), 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);//Attatch the neon object to the vehicle(Do not change coordinates)..
- GivePlayerMoney(playerid, - RED_NEONS_PRICE);//Remove the RED_NEONS_PRICE from the players holding amount..
- PlayerPlaySound(playerid, 1133, 0.0, 0.0, 0.0);//Play the sound that you hear when you tune a car in transfender..
- new string[80];//Define our string to use later ti format RED_NEONS_PRICE into a string and show it in a message..
- format(string, sizeof(string), "You have successfully added red neons to your vehicle. Cost: $%d", RED_NEONS_PRICE);//Format the string..
- SendClientMessage(playerid, COLOUR_WHITE, string);//Send a client message with the formatted string..
- }
- else
- {
- SendClientMessage(playerid, COLOUR_RED,"You dont have enough money to purchase this modification.");//Else they dont have the cost of RED_NEONS_PRICE..
- }
- }
- case 2://If they click green neons..
- {
- if(GetPlayerMoney(playerid) >= GREEN_NEONS_PRICE)//Check if there there holding amount is more or equal to GREEN_NEONS_PRICE if so..
- {
- SetPVarInt(playerid, "HasGreenNeons", 1);//Set there status in a player variable..
- SetPVarInt(playerid, "GreenNeons1", CreateObject(18649,0,0,0,0,0,0));//Set the neon object into a player variable..
- SetPVarInt(playerid, "GreenNeons2", CreateObject(18649,0,0,0,0,0,0));//Set the neon object into a player variable..
- AttachObjectToVehicle(GetPVarInt(playerid, "GreenNeons1"), GetPlayerVehicleID(playerid), -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);//Attatch the neon object to the vehicle(Do not change coordinates)..
- AttachObjectToVehicle(GetPVarInt(playerid, "GreenNeons2"), GetPlayerVehicleID(playerid), 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);//Attatch the neon object to the vehicle(Do not change coordinates)..
- GivePlayerMoney(playerid, - GREEN_NEONS_PRICE);//Remove the GREEN_NEONS_PRICE from the players holding amount..
- PlayerPlaySound(playerid, 1133, 0.0, 0.0, 0.0);//Play the sound that you hear when you tune a car in transfender..
- new string[80];//Define our string to use later ti format GREEN_NEONS_PRICE into a string and show it in a message..
- format(string, sizeof(string), "You have successfully added green neons to your vehicle. Cost: $%d", GREEN_NEONS_PRICE);//Format the string..
- SendClientMessage(playerid, COLOUR_WHITE, string);//Send a client message with the formatted string..
- }
- else
- {
- SendClientMessage(playerid, COLOUR_RED,"You dont have enough money to purchase this modification.");//Else they dont have the cost of GREEN_NEONS_PRICE..
- }
- }
- case 3://If they click yellow neons..
- {
- if(GetPlayerMoney(playerid) >= YELLOW_NEONS_PRICE)//Check if there there holding amount is more or equal to YELLOW_NEONS_PRICE if so..
- {
- SetPVarInt(playerid, "HasYellowNeons", 1);//Set there status in a player variable..
- SetPVarInt(playerid, "YellowNeons1", CreateObject(18650,0,0,0,0,0,0));//Set the neon object into a player variable..
- SetPVarInt(playerid, "YellowNeons2", CreateObject(18650,0,0,0,0,0,0));//Set the neon object into a player variable..
- AttachObjectToVehicle(GetPVarInt(playerid, "YellowNeons1"), GetPlayerVehicleID(playerid), -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);//Attatch the neon object to the vehicle(Do not change coordinates)..
- AttachObjectToVehicle(GetPVarInt(playerid, "YellowNeons2"), GetPlayerVehicleID(playerid), 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);//Attatch the neon object to the vehicle(Do not change coordinates)..
- GivePlayerMoney(playerid, - YELLOW_NEONS_PRICE);//Remove the YELLOW_NEONS_PRICE from the players holding amount..
- PlayerPlaySound(playerid, 1133, 0.0, 0.0, 0.0);//Play the sound that you hear when you tune a car in transfender..
- new string[80];//Define our string to use later ti format YELLOW_NEONS_PRICE into a string and show it in a message..
- format(string, sizeof(string), "You have successfully added yellow neons to your vehicle. Cost: $%d", YELLOW_NEONS_PRICE);//Format the string..
- SendClientMessage(playerid, COLOUR_WHITE, string);//Send a client message with the formatted string..
- }
- else
- {
- SendClientMessage(playerid, COLOUR_RED,"You dont have enough money to purchase this modification.");//Else they dont have the cost of YELLOW_NEONS_PRICE..
- }
- }
- case 4://If they click pink neons..
- {
- if(GetPlayerMoney(playerid) >= PINK_NEONS_PRICE)//Check if there there holding amount is more or equal to PINK_NEONS_PRICE if so..
- {
- SetPVarInt(playerid, "HasPinkNeons", 1);//Set there status in a player variable..
- SetPVarInt(playerid, "PinkNeons1", CreateObject(18651,0,0,0,0,0,0));//Set the neon object into a player variable..
- SetPVarInt(playerid, "PinkNeons2", CreateObject(18651,0,0,0,0,0,0));//Set the neon object into a player variable..
- AttachObjectToVehicle(GetPVarInt(playerid, "PinkNeons1"), GetPlayerVehicleID(playerid), -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);//Attatch the neon object to the vehicle(Do not change coordinates)..
- AttachObjectToVehicle(GetPVarInt(playerid, "PinkNeons2"), GetPlayerVehicleID(playerid), 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);//Attatch the neon object to the vehicle(Do not change coordinates)..
- GivePlayerMoney(playerid, - PINK_NEONS_PRICE);//Remove the PINK_NEONS_PRICE from the players holding amount..
- PlayerPlaySound(playerid, 1133, 0.0, 0.0, 0.0);//Play the sound that you hear when you tune a car in transfender..
- new string[80];//Define our string to use later ti format PINK_NEONS_PRICE into a string and show it in a message..
- format(string, sizeof(string), "You have successfully added pink neons to your vehicle. Cost: $%d", PINK_NEONS_PRICE);//Format the string..
- SendClientMessage(playerid, COLOUR_WHITE, string);//Send a client message with the formatted string..
- }
- else
- {
- SendClientMessage(playerid, COLOUR_RED,"You dont have enough money to purchase this modification.");//Else they dont have the cost of PINK_NEONS_PRICE..
- }
- }
- case 5://If they click remove neons..
- {
- if(GetPVarInt(playerid, "HasBlueNeons") == 1)//If they have blue neons..
- {
- DeletePVar(playerid, "HasBlueNeons");//Remove there status..
- DestroyObject(GetPVarInt(playerid, "BlueNeons1"));//And objects..
- DestroyObject(GetPVarInt(playerid, "BlueNeons2"));//And objects..
- SendClientMessage(playerid, COLOUR_WHITE, "You have successfully removed the neons from your vehicle.");//Send them a message telling them they removed there neons..
- }
- else if(GetPVarInt(playerid, "HasRedNeons") == 1)//If they have red neons..
- {
- DeletePVar(playerid, "HasRedNeons");//Remove there status..
- DestroyObject(GetPVarInt(playerid, "RedNeons1"));//And objects..
- DestroyObject(GetPVarInt(playerid, "RedNeons2"));//And objects..
- SendClientMessage(playerid, COLOUR_WHITE, "You have successfully removed the neons from your vehicle.");//Send them a message telling them they removed there neons..
- }
- else if(GetPVarInt(playerid, "HasGreenNeons") == 1)//If they have green neons..
- {
- DeletePVar(playerid, "HasGreenNeons");//Remove there status..
- DestroyObject(GetPVarInt(playerid, "GreenNeons1"));//And objects..
- DestroyObject(GetPVarInt(playerid, "GreenNeons2"));//And objects..
- SendClientMessage(playerid, COLOUR_WHITE, "You have successfully removed the neons from your vehicle.");//Send them a message telling them they removed there neons..
- }
- else if(GetPVarInt(playerid, "HasYellowNeons") == 1)//If they have yellow neons..
- {
- DeletePVar(playerid, "HasYellowNeons");//Remove there status..
- DestroyObject(GetPVarInt(playerid, "YellowNeons1"));//And objects..
- DestroyObject(GetPVarInt(playerid, "YellowNeons2"));//And objects..
- SendClientMessage(playerid, COLOUR_WHITE, "You have successfully removed the neons from your vehicle.");//Send them a message telling them they removed there neons..
- }
- else if(GetPVarInt(playerid, "HasPinkNeons") == 1)//If they have pink neons..
- {
- DeletePVar(playerid, "HasPinkNeons");//Remove there status..
- DestroyObject(GetPVarInt(playerid, "PinkNeons1"));//And objects..
- DestroyObject(GetPVarInt(playerid, "PinkNeons2"));//And objects..
- SendClientMessage(playerid, COLOUR_WHITE, "You have successfully removed the neons from your vehicle.");//Send them a message telling them they removed there neons..
- }
- else
- {
- SendClientMessage(playerid, COLOUR_WHITE, "You dont have any neons to remove.");//Else they dont have any neons to remove..
- }
- }
- }
- }
- }
- }
- return 1;
- }
- public OnVehicleDeath(vehicleid, killerid)
- {
- new i;//New i which defines our playerid..
- for(i = 0; i < MAX_PLAYERS; i ++)// i = 0 and is less than MAX_PLAYERS, increase 0 and loop untill you get to MAX_PLAYERS and return 1..
- {
- if(IsPlayerConnected(i) && GetPlayerVehicleID(i) == vehicleid)//If the player id is connected and there vehicle id = the vehicleid that was destroyed..
- {
- if(GetPVarInt(i, "HasBlueNeons") == 1)//If they have blue neons..
- {
- DeletePVar(i, "HasBlueNeons");//Remove there status..
- DestroyObject(GetPVarInt(i, "BlueNeons1"));//And objects..
- DestroyObject(GetPVarInt(i, "BlueNeons2"));//And objects..
- }
- else if(GetPVarInt(i, "HasRedNeons") == 1)//If they have red neons..
- {
- DeletePVar(i, "HasRedNeons");//Remove there status..
- DestroyObject(GetPVarInt(i, "RedNeons1"));//And objects..
- DestroyObject(GetPVarInt(i, "RedNeons2"));//And objects..
- }
- else if(GetPVarInt(i, "HasGreenNeons") == 1)//If they have green neons..
- {
- DeletePVar(i, "HasGreenNeons");//Remove there status..
- DestroyObject(GetPVarInt(i, "GreenNeons1"));//And objects..
- DestroyObject(GetPVarInt(i, "GreenNeons2"));//And objects..
- }
- else if(GetPVarInt(i, "HasYellowNeons") == 1)//If they have yellow neons..
- {
- DeletePVar(i, "HasYellowNeons");//Remove there status..
- DestroyObject(GetPVarInt(i, "YellowNeons1"));//And objects..
- DestroyObject(GetPVarInt(i, "YellowNeons2"));//And objects..
- }
- else if(GetPVarInt(i, "HasPinkNeons") == 1)//If they have pink neons..
- {
- DeletePVar(i, "HasPinkNeons");//Remove there status..
- DestroyObject(GetPVarInt(i, "PinkNeons1"));//And objects..
- DestroyObject(GetPVarInt(i, "PinkNeons2"));//And objects..
- }
- }
- }
- return 1;
- }
- /*
- Tutorial/Script by Godhimself
- */
Advertisement
Add Comment
Please, Sign In to add comment