ChainsBoy

Mehaanik

Nov 5th, 2012
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 4.02 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. enum pInfo {
  4. mFranks,
  5. }
  6.  
  7. new KasutajaInfo[MAX_PLAYERS][pInfo];
  8. new MNoustu[MAX_PLAYERS];
  9. new Mehaanik[MAX_PLAYERS];
  10. new MKlient[MAX_PLAYERS];
  11. new Parandust[MAX_PLAYERS];
  12. new ParandusHind[MAX_PLAYERS];
  13. new ParandaAuto[MAX_PLAYERS];
  14.  
  15. public OnPlayerCommandText(playerid, cmdtext[])
  16. {
  17.     new string[256];
  18.     new playermoney;
  19.     new sendername[MAX_PLAYER_NAME];
  20.     new giveplayer[MAX_PLAYER_NAME];
  21.     new playername[MAX_PLAYER_NAME];
  22.     new cmd[256];
  23.     new tmp[256];
  24.     new giveplayerid, moneys, idx;
  25.     cmd = strtok(cmdtext, idx);
  26.  
  27.  
  28.  
  29.     if(strcmp("/paranda", cmdtext, true, 10) == 0)
  30.     {
  31.         if(IsPlayerConnected(playerid))
  32.         {
  33.             if (KasutajaInfo[playerid][mFranks] != 1) return SendClientMessage(playerid, 0x00000000, "Sa pole mehaanik!");
  34.             {
  35.                 SendClientMessage(playerid, 0x00000000, "Saa ei ole mehaanik!");
  36.                 return 1;
  37.             }
  38.             tmp = strtok(cmdtext, idx);
  39.             if(!strlen(tmp))
  40.             {
  41.                 SendClientMessage(playerid, 0x00000000, "Kasutus: /paranda[MänigjaID/MängijaNimi] [hind]");
  42.                 return 1;
  43.             }
  44.             new mangija;
  45.             new raha;
  46.             mangija = ReturnUser(tmp);
  47.             tmp = strtok(cmdtext, idx);
  48.             raha = strval(tmp);
  49.             if(raha < 1 || raha > 500) { SendClientMessage(playerid, 0x00000000, "Hind peab olema 1 ja 500 vahel!"); return 1; }
  50.             if(IsPlayerConnected(mangija))
  51.             {
  52.                 if(mangija != INVALID_PLAYER_ID)
  53.                 {
  54.                     if(ProxDetectorS(8.0, playerid, mangija)&& IsPlayerInAnyVehicle(mangija))
  55.                     {
  56.                         if(mangija == playerid) { SendClientMessage(playerid, 0x00000000, "Ei saa seda teha!"); return 1; }
  57.                         GetPlayerName(mangija, giveplayer, sizeof(giveplayer));
  58.  
  59.                         format(string, sizeof(string), "* Pakusid mängijale %s et parandada nende sõidukit $%d krooni eest .",giveplayer,raha);
  60.                         SendClientMessage(playerid, 0x00000000, string);
  61.                         format(string, sizeof(string), "* Mehaanik %s pakub parandamis teenust $%d krooni eest (kirjuta /nõustu parandus).",sendername,raha);
  62.                         SendClientMessage(mangija, 0x00000000, string);
  63.                         Parandust[mangija] = playerid;
  64.                         ParanusHind[mangija] = raha;
  65.                     }
  66.                     else
  67.                     {
  68.                         SendClientMessage(playerid, 0x00000000, "Mängijat pole ligidal/autos.");
  69.                     }
  70.                 }
  71.             }
  72.             else
  73.             {
  74.                 SendClientMessage(playerid, 0x00000000, "Mängijat ei ole online.");
  75.             }
  76.         }
  77.         }
  78.  
  79.  
  80. ///////////////////////////////////////////
  81.     if(strcmp("/nõustu parandust", cmdtext, true, 10) == 0)
  82.     {
  83.         if(IsPlayerConnected(playerid))
  84.         {
  85.                 if(Parandust[playerid] < 999)
  86.                 {
  87.                     if(GetPlayerMoney(playerid) > ParandusHind[playerid])
  88.                     {
  89.                         if(IsPlayerInAnyVehicle(playerid))
  90.                         {
  91.                             if(IsPlayerConnected(Parandust[playerid]))
  92.                             {
  93.                                 GetPlayerName(Parandust[playerid], giveplayer, sizeof(giveplayer));
  94.  
  95.                                 ParandaAuto[playerid] = GetPlayerVehicleID(playerid);
  96.                                 SetVehicleHealth(ParandaAuto[playerid], 1000.0);
  97.                                 format(string, sizeof(string), "You repaired your car for $%d by Car Mechanic %s.",ParandusHind[playerid],giveplayer);
  98.                                 SendClientMessage(playerid, 0x00000000, string);
  99.                                 format(string, sizeof(string), "Parandasid %s sõiduki, $%d lisati sinu palgale.",sendername,ParandusHind[playerid]);
  100.                                 SendClientMessage(Parandust[playerid], 0x00000000, string);
  101.                                 GivePlayerMoney(playerid, -ParandusHind[playerid]);
  102.                                 GivePlayerMoney(Parandust[playerid], ParandusHind[playerid]);
  103.                                 Parandust[playerid] = 999;
  104.                                 ParandusHind[playerid] = 0;
  105.                                 SendClientMessage(Parandust[playerid], 0x00000000, string);
  106.                                 return 1;
  107.                             }
  108.                             return 1;
  109.                         }
  110.                         return 1;
  111.                     }
  112.                     else
  113.                     {
  114.                         SendClientMessage(playerid, 0x00000000, "   Sul ei ole küllaltgi palju raha paranduse jaoks!");
  115.                         return 1;
  116.                     }
  117.                 }
  118.                 else
  119.                 {
  120.                     SendClientMessage(playerid, 0x0000000, "   Keegi pole sulle parandust pakkunud!");
  121.                     return 1;
  122.                 }
  123.             }
  124.             return 1;
  125.             }
  126.        
  127.         return 1;
  128.     }
Advertisement
Add Comment
Please, Sign In to add comment