Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define FILTERSCRIPT
- #include <a_samp>
- #include <zcmd>
- #include <sscanf2>
- new bool:g_Timer;
- new bool:ASpray[MAX_PLAYERS];
- new bool:OSpray[MAX_PLAYERS];
- new bool:SentSpray[MAX_PLAYERS];
- new SenderID;
- new id;
- enum {
- DIALOG_CAR_SPRAY
- }
- public OnFilterScriptInit()
- {
- print(" **************************");
- print(" ");
- print(" Successfully Loaded");
- print(" OxiSprays Version 1.0");
- print(" ");
- print(" Created by OxigEN.");
- print(" 19/09/2014");
- print(" ");
- print(" **************************");
- return 1;
- }
- public OnFilterScriptExit()
- {
- print(" **************************");
- print(" ");
- print(" Successfully UNLoaded");
- print(" OxiSprays Version 1.0");
- print(" ");
- print(" Created by OxigEN.");
- print(" 19/09/2014");
- print(" ");
- print(" **************************");
- return 1;
- }
- CMD:spray(playerid, params[])
- {
- if(!IsPlayerAdmin(playerid)) return 0;
- else GivePlayerWeapon(playerid, 41, 99999);
- return 1;
- }
- forward SprayTimer(playerid);
- public SprayTimer(playerid)
- {
- for(new i = 0; i < MAX_VEHICLES; i++)
- {
- new Float:x, Float:y, Float:z;
- if(!GetVehiclePos(i, x, y, z)) continue;
- if(IsPlayerInRangeOfPoint(playerid, 5, x, y, z))
- {
- g_Timer = false;
- return ShowPlayerDialog(playerid, DIALOG_CAR_SPRAY, DIALOG_STYLE_LIST, "Vehicle Color Change", "Color White\nColor White\nColor Red\nColor Green\nColor Blue\nColor Yellow\nColor Orange\n", "Change", "Exit");
- }
- }
- SendClientMessage(playerid, 0xFF0000FF, "You are not near the vehicle therefore you didn't get the color changing dialog.");
- g_Timer = false;
- ASpray[id] = false;
- SentSpray[id] = false;
- OSpray[playerid] = false;
- return 1;
- }
- CMD:ospray(playerid, params[])
- {
- new string[128];
- if(sscanf(params, "u", id)) return SendClientMessage(playerid, 0xFF0000FF, "SYNTAX: /OSpray [ID]");
- else if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, 0xFF0000FF, "The ID specified is invalid.");
- else if(OSpray[id] == true) return SendClientMessage(playerid, 0xFF0000FF, "Someone already sent an offer to the ID specified.");
- else if(SentSpray[playerid] == true) return SendClientMessage(playerid, 0xFF0000FF, "You already sent an offer to someone.");
- else
- {
- new Float:x, Float:y, Float:z;
- GetPlayerPos(playerid, x, y, z);
- if(IsPlayerInRangeOfPoint(id, 10, x, y, z))
- {
- format(string, sizeof(string), "You have sent %s(%d) an offer to paint their vehicle, Please wait for them to accept it.", GetName(id), id);
- SendClientMessage(playerid, 0xFF0000FF, string);
- format(string, sizeof(string), "You have received an offer to paint your vehicle from %s(%d)\nTo accept it write /ASpray [ID].", GetName(playerid), playerid);
- SendClientMessage(id, 0xFF0000FF, string);
- OSpray[id] = true;
- SentSpray[playerid] = true;
- SenderID = playerid;
- }
- else return
- SendClientMessage(playerid, 0xFF0000FF, "àéï àó àçã ìéãê");
- }
- return 1;
- }
- CMD:aspray(playerid, params[])
- {
- new string[128];
- if(sscanf(params, "u", id)) return SendClientMessage(playerid, 0xFF0000FF, "SYNTAX: /ASpray [ID]");
- if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, 0xFF0000FF, "The ID specified is invalid.");
- else if(id != SenderID) return SendClientMessage(playerid, 0xFF0000FF, "The ID you've entered didn't send you an offer to change your vehicle's color.");
- else if(OSpray[playerid] == false) return SendClientMessage(playerid, 0xFF0000FF, "No one has sent you an offer to change your vehicle's color.");
- else
- {
- format(string, sizeof(string), "You have accepted %s(%d)'s offer to paint your vehicle!", GetName(id), id);
- SendClientMessage(playerid, 0xFF0000FF, string);
- format(string, sizeof(string), "%s(%d) has accepted your offer to paint their vehicle!", GetName(playerid), playerid);
- SendClientMessage(id, 0xFF0000FF, string);
- ASpray[playerid] = true;
- SentSpray[id] = false;
- OSpray[playerid] = false;
- }
- return 1;
- }
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- if(newkeys & KEY_FIRE && GetPlayerWeapon(playerid) == 41)
- {
- if(IsPlayerInAnyVehicle(playerid)) return SetPlayerArmedWeapon(playerid, 0);
- else
- {
- if(ASpray[playerid] == false) return SendClientMessage(playerid, 0xFF0000FF, "No one has accepted your offer to change their vehicle's color.");
- else
- {
- new Float:x, Float:y, Float:z;
- for(new i = 0; i < MAX_VEHICLES; i++)
- {
- if(!GetVehiclePos(i, x, y, z)) continue;
- if(IsPlayerInRangeOfPoint(playerid, 10, x, y, z))
- {
- if(g_Timer == false)
- {
- SetTimerEx("SprayTimer", 15000, false, "d", playerid);
- g_Timer = true;
- return SendClientMessage(playerid, 0xFF0000FF, "You have started to paint the vehicle. Please do this for 15 seconds.");
- }
- else
- {
- return SendClientMessage(playerid, 0xFF0000FF, "There is already a timer running, Please wait while the current timer ends.");
- }
- }
- }
- SendClientMessage(playerid, 0xFF0000FF, "You are not near any vehicle!");
- }
- }
- }
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- new Float:x, Float:y, Float:z;
- if(dialogid == DIALOG_CAR_SPRAY)
- {
- if(!response) return SendClientMessage(playerid, 0xFF0000FF, "You chose to decline the vehicle color changing dialog.");
- if(response)
- {
- switch(listitem)
- {
- case 0:
- {
- for(new i = 0; i < MAX_VEHICLES; i++)
- {
- GetVehiclePos(i, x, y, z);
- if(IsPlayerInRangeOfPoint(playerid, 5, x, y, z))
- {
- ChangeVehicleColor(i, 1, 1);
- ASpray[id] = false;
- SentSpray[id] = false;
- OSpray[playerid] = false;
- GivePlayerMoney(playerid, -500);
- RepairVehicle(i);
- }
- }
- }
- case 1:
- {
- for(new i = 0; i < MAX_VEHICLES; i++)
- {
- GetVehiclePos(i, x, y, z);
- if(IsPlayerInRangeOfPoint(playerid, 5, x, y, z))
- {
- ChangeVehicleColor(i, 0, 0);
- ASpray[id] = false;
- SentSpray[id] = false;
- OSpray[playerid] = false;
- GivePlayerMoney(playerid, -500);
- RepairVehicle(i);
- }
- }
- }
- case 2:
- {
- for(new i = 0; i < MAX_VEHICLES; i++)
- {
- GetVehiclePos(i, x, y, z);
- if(IsPlayerInRangeOfPoint(playerid, 5, x, y, z))
- {
- ChangeVehicleColor(i, 3, 3);
- ASpray[id] = false;
- SentSpray[id] = false;
- OSpray[playerid] = false;
- GivePlayerMoney(playerid, -500);
- RepairVehicle(i);
- }
- }
- }
- case 3:
- {
- for(new i = 0; i < MAX_VEHICLES; i++)
- {
- GetVehiclePos(i, x, y, z);
- if(IsPlayerInRangeOfPoint(playerid, 5, x, y, z))
- {
- ChangeVehicleColor(i, 16, 16);
- ASpray[id] = false;
- SentSpray[id] = false;
- OSpray[playerid] = false;
- GivePlayerMoney(playerid, -500);
- RepairVehicle(i);
- }
- }
- }
- case 4:
- {
- for(new i = 0; i < MAX_VEHICLES; i++)
- {
- GetVehiclePos(i, x, y, z);
- if(IsPlayerInRangeOfPoint(playerid, 5, x, y, z))
- {
- ChangeVehicleColor(i, 7, 7);
- ASpray[id] = false;
- SentSpray[id] = false;
- OSpray[playerid] = false;
- GivePlayerMoney(playerid, -500);
- RepairVehicle(i);
- }
- }
- }
- case 5:
- {
- for(new i = 0; i < MAX_VEHICLES; i++)
- {
- GetVehiclePos(i, x, y, z);
- if(IsPlayerInRangeOfPoint(playerid, 5, x, y, z))
- {
- ChangeVehicleColor(i, 6, 6);
- ASpray[id] = false;
- SentSpray[id] = false;
- OSpray[playerid] = false;
- GivePlayerMoney(playerid, -500);
- RepairVehicle(i);
- }
- }
- }
- case 6:
- {
- for(new i = 0; i < MAX_VEHICLES; i++)
- {
- GetVehiclePos(i, x, y, z);
- if(IsPlayerInRangeOfPoint(playerid, 5, x, y, z))
- {
- ChangeVehicleColor(i, 158, 158);
- ASpray[id] = false;
- SentSpray[id] = false;
- OSpray[playerid] = false;
- GivePlayerMoney(playerid, -500);
- RepairVehicle(i);
- }
- }
- }
- }
- }
- return 1;
- }
- return 0;
- }
- stock GetName(playerid)
- {
- new Name[MAX_PLAYER_NAME];
- GetPlayerName(playerid, Name, sizeof(Name));
- return Name;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement