Advertisement
Guest User

OnPlayerKeyStateChange

a guest
Dec 20th, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 4.09 KB | None | 0 0
  1. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) {
  2.     switch(newkeys) {
  3.         case KEY_SECONDARY_ATTACK: {
  4.             if(inBusinessArea[playerid] > -1) {
  5.                 new bizzid = inBusinessArea[playerid];
  6.                 if(bizzInfo[bizzid][bStatic] == 0) {
  7.                     if(getPlayerMoney(playerid) < bizzInfo[bizzid][bFee]) return sendError(playerid, "Nu ai %s$ pentru a intra.", "You do not have %s$ to enter.", formatNumber(bizzInfo[bizzid][bFee]));
  8.                     if(bizzInfo[bizzid][bLocked] != 1) return sendError(playerid, "Acest business este incuiat.", "Business is locked.");
  9.                     if(gettime() < GetPVarInt(playerid, "enterBusiness")) return sendError(playerid, "Asteapta %d secunde.", "Please wait %d seconds.", GetPVarInt(playerid, "enterBusiness") - gettime());
  10.                     SetPlayerPos(playerid, bizzInfo[bizzid][bIntX], bizzInfo[bizzid][bIntY], bizzInfo[bizzid][bIntZ]);
  11.                     SetPlayerInterior(playerid, bizzInfo[bizzid][bInterior]);
  12.                     SetPlayerVirtualWorld(playerid, bizzid);
  13.                     inBusiness[playerid] = bizzid;
  14.                     bizzInfo[bizzid][bProduction] += bizzInfo[bizzid][bFee];
  15.                     SetPVarInt(playerid, "enterBusiness", gettime() + 10);
  16.  
  17.                     switch(bizzInfo[bizzid][bType]) {
  18.                         case 1: SCM(playerid, -1, "Welcome! The commands of this business are as follows: /withdraw, /deposit, /transfer");
  19.                         case 2: SCM(playerid, -1, "Welcome! The commands of this business are as follows: /buy");
  20.                         case 3: SCM(playerid, -1, "Welcome! The commands of this business are as follows: /buygun");
  21.                         case 4: SCM(playerid, -1, "Welcome! The commands of this business are as follows: /buydrink");
  22.                         case 5: SCM(playerid, -1, "Welcome! The commands of this business are as follows: /buytoys");
  23.                         case 6: SCM(playerid, -1, "Welcome! The commands of this business are as follows: /dice");
  24.                         case 7: SCM(playerid, -1, "Welcome! The commands of this business are as follows: /eat");
  25.                         case 8: SCM(playerid, -1, "Welcome! The commands of this business are as follows: /buyfightstyle");
  26.                         case 9: SCM(playerid, -1, "Welcome! The commands of this business are as follows: /clothes");
  27.                         case 10: SCM(playerid, -1, "Welcome! The commands of this business are as follows: /eat");
  28.                     }
  29.                     va_GameTextForPlayer(playerid, "~R~-%s$", 2000, 1, formatNumber(bizzInfo[bizzid][bFee]));
  30.                     givePlayerMoney(playerid, -bizzInfo[bizzid][bFee]);
  31.                     gQuery[0] = (EOS);
  32.                     mysql_format(SQL, gQuery, 256, "UPDATE `server_business` SET `bizzProduction`='%d' WHERE `bizzID`='%d' LIMIT 1", bizzInfo[bizzid][bProduction], bizzid);
  33.                     mysql_pquery(SQL, gQuery, "", "");
  34.                 }
  35.             }
  36.             if(inBusiness[playerid] > -1 && IsPlayerInRangeOfPoint(playerid, 2.0, bizzInfo[inBusiness[playerid]][bIntX], bizzInfo[inBusiness[playerid]][bIntY], bizzInfo[inBusiness[playerid]][bIntZ])) {
  37.                 new bizzid = inBusiness[playerid];
  38.                 if(bizzid == GetPlayerVirtualWorld(playerid)) {
  39.                     SetPlayerInterior(playerid, 0); SetPlayerVirtualWorld(playerid, 0);
  40.                     SetPlayerPos(playerid, bizzInfo[bizzid][bX], bizzInfo[bizzid][bY], bizzInfo[bizzid][bZ]);
  41.                     inBusiness[playerid] = -1;
  42.                 }
  43.             }
  44.             /// Factions
  45.             if(inFactionArea[playerid] > -1) {
  46.                 new factionid = inFactionArea[playerid];
  47.                 if(factionInfo[factionid][fHQStatus] == 1) {
  48.                     SetPlayerPos(playerid, factionInfo[factionid][fIntX], factionInfo[factionid][fIntY], factionInfo[factionid][fIntZ]);
  49.                     SetPlayerInterior(playerid, factionInfo[factionid][fInterior]);
  50.                     SetPlayerVirtualWorld(playerid, factionid);
  51.                     inFaction[playerid] = factionid;
  52.                 } else return sendError(playerid, "Aceasta factiune este incuiata.", "This faction is locked.");
  53.             }
  54.             if(inFaction[playerid] > -1 && IsPlayerInRangeOfPoint(playerid, 2.0, factionInfo[inFaction[playerid]][fIntX], factionInfo[inFaction[playerid]][fIntY], factionInfo[inFaction[playerid]][fIntZ])) {
  55.                 new factionid = inFaction[playerid];
  56.                 if(factionid == GetPlayerVirtualWorld(playerid)) {
  57.                     SetPlayerInterior(playerid, 0); SetPlayerVirtualWorld(playerid, 0);
  58.                     SetPlayerPos(playerid, factionInfo[factionid][facX], factionInfo[factionid][facY], factionInfo[factionid][facZ]);
  59.                     inFaction[playerid] = -1;
  60.                 }
  61.             }
  62.         }
  63.     }
  64.     return true; }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement