Advertisement
Gireada

Comanda /fill

Jan 14th, 2016
251
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.87 KB | None | 0 0
  1. if(strcmp(cmd, "/fill", true) == 0)
  2. {
  3.     new string[32];
  4.     tmp = strtok(cmdtext, idx);
  5.     if(strlen(tmp) == 0)
  6.     {
  7.         SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /fill [litrii]");
  8.         format(string, sizeof(string), "Poti alimenta %d litrii", GasMax - Gas[VID]);
  9.         SendClientMessage(playerid, 0xFFFFFFFF, string);
  10.         return 1;
  11.        
  12.     }  
  13.     new litrii = strval(tmp);
  14.     if(litrii > GasMax - Gas[VID])
  15.     {
  16.         format(string, sizeof(string), "Poti alimenta %d litrii", GasMax - Gas[VID]);
  17.         SendClientMessage(playerid, 0xFFFFFFFF, string);
  18.         return 1;
  19.     }
  20.     if(IsPlayerConnected(playerid))
  21.     {
  22.         if(IsAtGasStation(playerid))
  23.         {
  24.             TogglePlayerControllable(playerid, 0);
  25.             GameTextForPlayer(playerid,"~w~~n~~n~~n~~n~~n~~n~~n~~n~~n~Asteapta, se incarca",2000,3);
  26.             SetTimerEx("Fillup", RefuelWait, false, "i", litrii);
  27.             Refueling[playerid] = 1;
  28.         }
  29.         else
  30.         {
  31.             SendClientMessage(playerid,COLOR_GREY,"{30a030}[saveG]: {ffffff}Ne pare rau, dar nu te afli intr-o Statie de Gas.");
  32.         }
  33.     }
  34.     return 1;
  35. }
  36.  
  37. public Fillup(litrii)
  38. {
  39.     for(new i=0; i<MAX_PLAYERS; i++)
  40.     {
  41.         if(IsPlayerConnected(i))
  42.         {
  43.             new VID;
  44.             new cost;
  45.             new string[256];
  46.             VID = GetPlayerVehicleID(i);
  47.             if(Refueling[i] == 1)
  48.             {
  49.                 cost = litrii * SBizzInfo[3][sbEntranceCost];
  50.                 if(GetPlayerMoney(i) >= cost)
  51.                 {
  52.                     Gas[VID] += litrii;
  53.                     format(string,sizeof(string),"» Ai facut plinul la Vehicul: Pret: %d Lei.",cost);
  54.                     SendClientMessage(i,COLOR_LIGHTBLUE,string);
  55.                     GivePlayerMoney(i, - cost);
  56.                     SBizzInfo[3][sbTill] += cost;
  57.                     ExtortionSBiz(3, cost);
  58.                     Refueling[i] = 0;
  59.                     TogglePlayerControllable(i, 1);
  60.                 }
  61.                 else
  62.                 {
  63.                     format(string,sizeof(string),"» Ne pare rau, dar nu ai %d Lei pentru a alimenta Vehiculul.",cost);
  64.                     SendClientMessage(i,COLOR_LIGHTBLUE,string);
  65.                 }
  66.             }
  67.         }
  68.     }
  69.     return 1;
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement