Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* /robstore command
- thought of and scripted
- by Ryan Undering */
- //==============================================================================
- #include <a_samp>
- #define Grey 0xAFAFAFAA
- #define Red 0xFF6347AA
- #define Yellow 0xFFFF00A
- #define robumont 20000
- new StoreRobed[MAX_PLAYERS];
- new Robber[MAX_PLAYERS];
- new rob;
- new rob1;
- new rob2;
- new robbing;
- forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);
- forward StoreRob1();
- forward StoreRob2();
- forward StoreRob3();
- forward RobAgain();
- //=====================================================================================================
- public OnFilterScriptInit()
- {
- robbing = 0;
- print(" Loading /robstore Command ");
- SetTimer("RobAgain2",1800000,1);
- return 1;
- }
- public OnFilterScriptExit()
- {
- print(" Unloading /robstore Command ");
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- StoreRobed[playerid] = 0;
- Robber[playerid] = 0;
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if (strcmp("/robstore", cmdtext, true, 10) == 0)
- {
- if (robbing == 1)
- {
- SendClientMessage(playerid, Red,"Someone are currently robbing the store!");
- return 1;
- }
- if(PlayerToPoint(20, playerid, -28.4819,-89.3805,1003.5469))
- {
- }
- else
- {
- SendClientMessage(playerid, Red,"you moust be in the store to rob it!");
- return 1;
- }
- if(StoreRobed[playerid] == 0)
- {
- SendClientMessageToAll(Red,"The 24/7 is being robbed, go check it out!");
- SendClientMessage(playerid, Yellow,"You have started to rob the store, Cops have been noted");
- SendClientMessage(playerid, Red,"Stay in the store for 1 min so you can claim the cash!");
- Robber[playerid] = 1;
- robbing = 1;
- StoreRobed[playerid] =1;
- rob = SetTimer("StoreRob1", 20000, 1);
- }
- return 1;
- }
- return 0;
- }
- public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
- {
- if(IsPlayerConnected(playerid))
- {
- new Float:oldposx, Float:oldposy, Float:oldposz;
- new Float:tempposx, Float:tempposy, Float:tempposz;
- GetPlayerPos(playerid, oldposx, oldposy, oldposz);
- tempposx = (oldposx -x);
- tempposy = (oldposy -y);
- tempposz = (oldposz -z);
- if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
- {
- return 1;
- }
- }
- return 0;
- }
- public StoreRob1()
- {
- for(new i = 0; i < MAX_PLAYERS; i++)
- if(Robber[i] == 1)
- {
- if(PlayerToPoint(30, i, -28.4819,-89.3805,1003.5469))
- {
- SendClientMessage(i, Yellow," 20 seconds has gone");
- KillTimer(rob);
- rob1 = SetTimer("StoreRob2",20000,1);
- return 1;
- }
- else
- {
- SendClientMessage(i, Grey,"You ran like a little girl");
- Robber[i] = 0;
- robbing = 0;
- return 1;
- }
- }
- return 1;
- }
- public StoreRob2()
- {
- for(new i = 0; i < MAX_PLAYERS; i++)
- if(Robber[i] == 1)
- {
- if(PlayerToPoint(30, i, -28.4819,-89.3805,1003.5469))
- {
- SendClientMessage(i, Yellow," 40 sekunds has gone");
- KillTimer(rob1);
- rob2 = SetTimer("StoreRob3",20000,1);
- return 1;
- }
- else
- {
- SendClientMessage(i, Grey,"You ran like a little girl");
- Robber[i] = 0;
- robbing = 0;
- return 1;
- }
- }
- return 1;
- }
- public StoreRob3()
- {
- for(new i = 0; i < MAX_PLAYERS; i++)
- if(Robber[i] == 1)
- {
- if(PlayerToPoint(30, i, -28.4819,-89.3805,1003.5469))
- {
- new pname[MAX_PLAYER_NAME];
- GetPlayerName(i, pname, sizeof(pname));
- new pcash = robumont;
- new robcash = random(pcash);
- new string[256];
- GetPlayerName(i, pname, sizeof(pname));
- format(string, sizeof(string), "You have Robbed the Store, well done, you get $%d", robcash);
- SendClientMessage(i, Yellow, string);
- GivePlayerMoney(i,robcash);
- Robber[i] = 0;
- robbing = 0;
- KillTimer(rob2);
- return 1;
- }
- else
- {
- SendClientMessage(i, Grey,"You ran like a little girl");
- Robber[i] = 0;
- robbing = 0;
- return 1;
- }
- }
- return 1;
- }
- public RobAgain()
- {
- for(new i = 0; i < MAX_PLAYERS; i++)
- StoreRobed[i] =0;
- }
Advertisement
Add Comment
Please, Sign In to add comment