Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * RC Shop
- * (c) Copyright 2011-2012 by FoxHound
- *
- * @author : FoxHound aka PSPgamer_10
- * @date : 12 February 2011
- * @version : v1.0
- *
- * This file is provided as is (no warranties).
- *
- * _____ _ _ _
- * | ___| | | | | | |
- * | |_ _____ __| |_| | ___ _ _ _ __ __| |
- * | _/ _ \ \/ /| _ |/ _ \| | | || '_ \ / _` |
- * | || (_) > < | | | | (_) | |_| || | | ||(_| |
- * \_| \___/_/\_\\_| |_/\___/ \__,_||_| |_|\__,_|
- *
- * +--+-+-+-+-+-+-+-+-+-+--+
- * | p r o d u c t i o n s |
- * +--+-+-+-+-+-+-+-+-+-+--+
- *
- */
- #include <a_samp>
- #include <dini>
- #define RcBuyDialog 1487
- #define ENABLE_RC_BUYING //Enable the RC-Vehicles Buying System (Comment if you dont want to use this)
- #define ENABLE_BUYING_RCBARON //Comment this if the Players shouldn't buy RcBaron (Note that RC Baron has a Gun, wich can kill the other Players in max. 3 seconds)
- #define ENABLE_RCZERO_ENTEREXIT //Comment this, if you have already the enter-exit's for RC-Zero in one of your scripts
- #define RcBandit 441
- #define RcRaider 465
- #define RcGoblin 501
- #define RcTiger 564
- #define RcCam 594
- #define RcBaron 464
- #define RcBanditCost 50000
- #define RcRaiderCost 80000
- #define RcGoblinCost 80000
- #define RcTigerCost 60000
- #define RcCamCost 30000
- #define RcBaronCost 1000000
- //RC-Shop Coordinates
- #define RcShopPosX -2236.9709
- #define RcShopPosY 130.1798
- #define RcShopPosZ 1035.4141
- enum enum_pData
- {
- pName[MAX_PLAYER_NAME],
- pRcFile[MAX_PLAYER_NAME+3],
- pRcVehID,
- Float:posX,Float:posY,Float:posZ
- };
- enum enum_rcShopData
- {
- rcTimer,
- rcPickup,
- rcZeroIn,
- rcZeroOut
- };
- new pData[MAX_PLAYERS][enum_pData],
- rcData[enum_rcShopData];
- public OnFilterScriptInit()
- {
- print("!* RC-Zero Shop");
- print("!* by FoxHound");
- print("!* successfully loaded !");
- #if defined ENABLE_RC_BUYING
- rcData[rcPickup] = AddStaticPickup(2469, 23, RcShopPosX, RcShopPosY, RcShopPosZ, -1); //Rc-Buy Pos
- #endif
- #if defined ENABLE_RCZERO_ENTEREXIT
- rcData[rcZeroIn] = AddStaticPickup(1559, 23, -2241.8171,128.6236,35.3203,-1); //RC-Zero In
- rcData[rcZeroOut] = AddStaticPickup(1559, 23, -2240.7825,137.1801,1035.4141,-1); //RC-Zero Out
- #endif
- rcData[rcTimer] = SetTimer("PlayerPosCheck",1000,1);
- return 1;
- }
- public OnFilterScriptExit()
- {
- KillTimer(rcData[rcTimer]);
- DestroyPickup(rcData[rcPickup]);
- DestroyPickup(rcData[rcZeroIn]);
- DestroyPickup(rcData[rcZeroOut]);
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- #if defined ENABLE_RC_BUYING
- GetPlayerName(playerid,pData[playerid][pName],MAX_PLAYER_NAME);
- format(pData[playerid][pRcFile],MAX_PLAYER_NAME+3,"%s.rc",pData[playerid][pName]);
- #endif
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- #if defined ENABLE_RC_BUYING
- if(pData[playerid][pRcVehID] != 0)
- {
- DestroyVehicle(pData[playerid][pRcVehID]);
- pData[playerid][pRcVehID] = 0;
- }
- #endif
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- #if defined ENABLE_RC_BUYING
- new mainstring[256];
- if(!strcmp(cmdtext,"/buyrc",true))
- {
- if(!IsPlayerInRangeOfPoint(playerid,3.0,RcShopPosX,RcShopPosY,RcShopPosZ)) { return SendClientMessage(playerid,0xFAFAFAFF,"You are not in the RC-Zero Shop !"); }
- if(dini_Exists(pData[playerid][pRcFile])) { return SendClientMessage(playerid,0xFF6347FF,"You already have a RC-Vehicle! Please sell it with /sellrc first!"); }
- format(mainstring,sizeof(mainstring),"RC-Bandit (Mini-Car) $%d\nRC-Raider (Mini-Heli) $%d\nRC-Goblin (Mini-Heli) $%d (in Red)\nRC-Tiger (Mini-Rhino) $%d\nRC-Cam (Flower pot) $%d",RcBanditCost,RcRaiderCost,RcGoblinCost,RcTigerCost,RcCamCost);
- #if defined ENABLE_BUYING_RCBARON
- new substring[64];
- format(substring,sizeof(substring),"\nRC-Baron (Mini-Dodo) $%d (+Integrated Gun)",RcBaronCost);
- strins(mainstring,substring,strlen(mainstring));
- #endif
- ShowPlayerDialog(playerid,RcBuyDialog,DIALOG_STYLE_LIST,"RC-Shop",mainstring,"Buy","Cancel");
- return 1;
- }
- if(!strcmp(cmdtext,"/sellrc",true))
- {
- new string[128],sellcost;
- if(!IsPlayerInRangeOfPoint(playerid,3.0,RcShopPosX,RcShopPosY,RcShopPosZ)) { return SendClientMessage(playerid,0xFAFAFAFF,"You are not in the RC-Zero Shop !"); }
- if(!dini_Exists(pData[playerid][pRcFile])) { return SendClientMessage(playerid,0xFAFAFAFF,"You haven't a RC Vehicle to sell !"); }
- switch(dini_Int(pData[playerid][pRcFile],"rcModel"))
- {
- case RcBandit: {
- sellcost = RcBanditCost/3;
- format(string, sizeof(string), "You sold your RC Bandit for $%d !", sellcost); }
- case RcRaider: {
- sellcost = RcRaiderCost/3;
- format(string, sizeof(string), "You sold your RC Raider for $%d !", sellcost); }
- case RcGoblin: {
- sellcost = RcGoblinCost/3;
- format(string, sizeof(string), "You sold your RC Goblin for $%d !", sellcost); }
- case RcTiger: {
- sellcost = RcTigerCost/3;
- format(string, sizeof(string), "You sold your RC Tiger for $%d !", sellcost); }
- case RcCam: {
- sellcost = RcCamCost/3;
- format(string, sizeof(string), "You sold your RC Cam for $%d !", sellcost); }
- case RcBaron: {
- sellcost = RcBaronCost/3;
- format(string, sizeof(string), "You sold your RC Baron for $%d !", sellcost); }
- }
- SendClientMessage(playerid, 0xFFFFFFFF, string);
- dini_Remove(pData[playerid][pRcFile]);
- GivePlayerMoney(playerid, sellcost);
- return 1;
- }
- if(!strcmp(cmdtext,"/userc",true))
- {
- new Float:pPos[4];
- if(!dini_Exists(pData[playerid][pRcFile])) { return SendClientMessage(playerid,0xFAFAFAFF,"You haven't got a RC Vehicle! You can buy one in the RC-Zero Shop."); }
- if(GetPlayerWantedLevel(playerid) > 0) { return SendClientMessage(playerid,0xFAFAFAFF,"You can't use your RC Vehicle because you have Wantedlevels!"); }
- if(pData[playerid][pRcVehID]!=0) { return 1; }
- GetPlayerPos(playerid,pPos[0],pPos[1],pPos[2]);
- GetPlayerFacingAngle(playerid,pPos[3]);
- pData[playerid][pRcVehID] = AddStaticVehicle(dini_Int(pData[playerid][pRcFile],"rcModel"),pPos[0],pPos[1],pPos[2],pPos[3],3,1);
- PutPlayerInVehicle(playerid,pData[playerid][pRcVehID],0);
- SendClientMessage(playerid,0x33CCFF00,"Type /exitrc to exit the RC Vehicle !");
- return 1;
- }
- if(!strcmp(cmdtext,"/exitrc",true))
- {
- if(pData[playerid][pRcVehID]==0) { return 1; }
- RemovePlayerFromVehicle(playerid);
- DestroyVehicle(pData[playerid][pRcVehID]);
- SetCameraBehindPlayer(playerid);
- pData[playerid][pRcVehID]=0;
- return 1;
- }
- #endif
- return 0;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- if(dialogid == RcBuyDialog)
- {
- new string[128];
- switch(response)
- {
- case 0: { return 1; }
- case 1:
- {
- if(!dini_Exists(pData[playerid][pRcFile])) { dini_Create(pData[playerid][pRcFile]); }
- switch(listitem)
- {
- case 0:
- {
- GivePlayerMoney(playerid,-RcBanditCost);
- dini_IntSet(pData[playerid][pRcFile],"rcModel",RcBandit);
- format(string,sizeof(string),"You bought a RC-Bandit for $%d !",RcBanditCost);
- SendClientMessage(playerid,0x33AA33AA,string);
- SendClientMessage(playerid,0x33AA33AA,"You can use it everytime when you haven't any Wanteds !");
- }
- case 1:
- {
- GivePlayerMoney(playerid,-RcRaiderCost);
- dini_IntSet(pData[playerid][pRcFile],"rcModel",RcRaider);
- format(string,sizeof(string),"You bought a RC-Raider for $%d !",RcRaiderCost);
- SendClientMessage(playerid,0x33AA33AA,string);
- SendClientMessage(playerid,0x33AA33AA,"You can use it everytime when you haven't any Wanteds !");
- }
- case 2:
- {
- GivePlayerMoney(playerid,-RcGoblinCost);
- dini_IntSet(pData[playerid][pRcFile],"rcModel",RcGoblin);
- format(string,sizeof(string),"You bought a RC-Goblin for $%d !",RcGoblinCost);
- SendClientMessage(playerid,0x33AA33AA,string);
- SendClientMessage(playerid,0x33AA33AA,"You can use it everytime when you haven't any Wanteds !");
- }
- case 3:
- {
- GivePlayerMoney(playerid,-RcTigerCost);
- dini_IntSet(pData[playerid][pRcFile],"rcModel",RcTiger);
- format(string,sizeof(string),"You bought a RC-Tiger for $%d !",RcTigerCost);
- SendClientMessage(playerid,0x33AA33AA,string);
- SendClientMessage(playerid,0x33AA33AA,"You can use it everytime when you haven't any Wanteds !");
- }
- case 4:
- {
- GivePlayerMoney(playerid,-RcCamCost);
- dini_IntSet(pData[playerid][pRcFile],"rcModel",RcCam);
- format(string,sizeof(string),"You bought a RC-Cam for $%d !",RcCamCost);
- SendClientMessage(playerid,0x33AA33AA,string);
- SendClientMessage(playerid,0x33AA33AA,"You can use it everytime when you haven't any Wanteds !");
- }
- case 5:
- {
- GivePlayerMoney(playerid,-RcBaronCost);
- dini_IntSet(pData[playerid][pRcFile],"rcModel",RcBaron);
- format(string,sizeof(string),"You bought a RC-Baron for $%d !",RcBaronCost);
- SendClientMessage(playerid,0x33AA33AA,string);
- SendClientMessage(playerid,0x33AA33AA,"You can use it everytime when you haven't any Wanteds !");
- SendClientMessage(playerid,0x33AA33AA,"But be careful! RC-Baron can kill Players with the Gun !");
- }
- }
- }
- }
- }
- return 1;
- }
- forward PlayerPosCheck();
- public PlayerPosCheck()
- {
- new i;
- for(; i<GetMaxPlayers(); i++)
- {
- if(IsPlayerConnected(i))
- {
- if(IsPlayerInRangeOfPoint(i,3.0,RcShopPosX,RcShopPosY,RcShopPosZ))
- {
- if(dini_Int(pData[i][pRcFile],"rcModel") <= 0)
- {
- #if defined ENABLE_RC_BUYING
- GameTextForPlayer(i,"~r~RC-Zero~n~~w~Type ~b~/buyrc ~w~to~n~~y~buy ~w~a RC Vehicle",1000,1);
- #endif
- }
- else
- {
- GameTextForPlayer(i,"~r~RC-Zero~n~~w~Type ~b~/sellrc ~w~to~n~~y~sell ~w~your RC Vehicle",1000,1);
- }
- }
- #if defined ENABLE_RCZERO_ENTEREXIT
- if(IsPlayerInRangeOfPoint(i,1.0,-2241.8171,128.6236,35.3203))
- {//RC-Zero In
- GameTextForPlayer(i, "~y~RC~b~-Zero", 1000, 3);
- SetPlayerPos(i, -2238.4312,136.8570,1035.4141);
- SetPlayerFacingAngle(i,240.0);
- SetCameraBehindPlayer(i);
- SetPlayerInterior(i,6);
- SetPlayerVirtualWorld(i, 0);
- }
- else if(IsPlayerInRangeOfPoint(i,1.0,-2240.7825,137.1801,1035.4141))
- {//RC-Zero Out
- GameTextForPlayer(i, "~b~San Fierro", 1000, 3);
- SetPlayerPos(i, -2243.8650,128.6740,35.3203);
- SetPlayerFacingAngle(i,90.0);
- SetCameraBehindPlayer(i);
- SetPlayerInterior(i,0);
- SetPlayerVirtualWorld(i, 0);
- }
- #endif
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement