Advertisement
Guest User

Untitled

a guest
Oct 7th, 2011
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 10.79 KB | None | 0 0
  1. dcmd_car(playerid, params[])
  2. {
  3.     if(PlayerInfo[playerid][pOwnsCar] == 0) return SendClientMessage(playerid, COLOR_GREY, "* You do not own a vehicle!");
  4.    
  5.     new car, vehicle,string[126];
  6.     car = PlayerInfo[playerid][pVehicle];
  7.     vehicle = CarInfo[car][ownedvehicle];
  8.  
  9.     new action[128], item[128], amount;
  10.    
  11.     if(sscanf(params, "s[128]S[128]D", action, item, amount))
  12.     {
  13.         SendClientMessage(playerid, COLOR_GREY, "* Usuage: /car [syntax]");
  14.         SendClientMessage(playerid, COLOR_GRAD2, "* Syntax: Check");
  15.         SendClientMessage(playerid, COLOR_GRAD3, "* Syntax: Put - pot crack mats weapon");
  16.         SendClientMessage(playerid, COLOR_GRAD4, "* Syntax: Get - pot crack mats weapon");
  17.         return 1;
  18.     }
  19.    
  20.     new Float:X, Float:Y, Float:Z;
  21.     GetVehiclePos(vehicle, X, Y, Z);
  22.    
  23.     if(!IsPlayerInRangeOfPoint(playerid, 5.0, X, Y, Z)) return SendClientMessage(playerid, COLOR_GREY, "* You are not close enough to your vehicle.");
  24.  
  25.     if(strcmp(action, "check") == 0)
  26.     {
  27.         new pot, crack, mats;
  28.         pot = CarInfo[car][vPot], crack = CarInfo[car][vCrack], mats = CarInfo[car][vMats];
  29.         SendClientMessage(playerid, COLOR_GREY, "__________ Car Storage __________");
  30.         format(string, sizeof(string), "Crack: %d - Pot: %d - Materials: %d", crack, pot, mats);
  31.         DisplayCarGuns(playerid);
  32.         SendClientMessage(playerid, COLOR_GRAD2, string);
  33.         return 1;
  34.     }
  35.    
  36.     if(strcmp(action, "put") == 0)
  37.     {
  38.         if(strcmp(item, "pot") == 0)
  39.         {
  40.             if(amount < 0) return SendClientMessage(playerid, COLOR_GREY, "* Usuage: /car put pot [amount]");
  41.            
  42.             new pot = PlayerInfo[playerid][pPot];
  43.            
  44.             if(amount > pot) return SendClientMessage(playerid, COLOR_GREY, "* You do not have that much Pot !");
  45.            
  46.             CarInfo[car][vPot] += amount;
  47.             format(string, sizeof(string), "* %s takes out something from his pocket and stores it into his vehicle.", PlayerName(playerid));
  48.             ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  49.            
  50.             PlayerInfo[playerid][pPot] -= amount;
  51.            
  52.             format(string, sizeof(string), "New amount after adding %d pot: %d", amount, CarInfo[car][vPot]);
  53.             SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
  54.            
  55.             return 1;
  56.         }
  57.        
  58.         if(strcmp(item, "crack") == 0)
  59.         {
  60.             if(!amount) return SendClientMessage(playerid, COLOR_GREY, "* Usuage: /car put crack [amount]");
  61.             if(amount < 0) return SendClientMessage(playerid, COLOR_GREY, "* Usuage: /car put crack [amount]");
  62.  
  63.             new crack = PlayerInfo[playerid][pCrack];
  64.  
  65.             if(amount > crack) return SendClientMessage(playerid, COLOR_GREY, "* You do not have that much Crack !");
  66.  
  67.             CarInfo[car][vCrack] += amount;
  68.             format(string, sizeof(string), "* %s takes out something from his pocket and stores it into his vehicle.", PlayerName(playerid));
  69.             ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  70.  
  71.             PlayerInfo[playerid][pCrack] -= amount;
  72.  
  73.             format(string, sizeof(string), "  New amount after adding %d crack: %d", amount, CarInfo[car][vCrack]);
  74.             SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
  75.  
  76.             return 1;
  77.         }
  78.        
  79.         if(strcmp(item, "mats") == 0)
  80.         {
  81.             if(!amount) return SendClientMessage(playerid, COLOR_GREY, "* Usuage: /car put mats [amount]");
  82.             if(amount < 0) return SendClientMessage(playerid, COLOR_GREY, "* Usuage: /car put mats [amount]");
  83.  
  84.             new mats = PlayerInfo[playerid][pMats];
  85.  
  86.             if(amount > mats) return SendClientMessage(playerid, COLOR_GREY, "* You do not have that many Materials !");
  87.  
  88.             CarInfo[car][vMats] += amount;
  89.             format(string, sizeof(string), "* %s takes out something from his pocket and stores it into his vehicle.", PlayerName(playerid));
  90.             ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  91.  
  92.             PlayerInfo[playerid][pMats] -= amount;
  93.  
  94.             format(string, sizeof(string), "  New amount after adding %d materials: %d", amount, CarInfo[car][vMats]);
  95.             SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
  96.  
  97.             return 1;
  98.         }
  99.        
  100.         if(strcmp(item, "weapon") == 0)
  101.         {
  102.             new gunid = GetPlayerWeapon(playerid);
  103.            
  104.             if(gunid == 0)
  105.             {
  106.                 SendClientMessage(playerid, COLOR_GREY, "* You are not holding a weapon.");
  107.                 return 1;
  108.             }
  109.            
  110.            
  111.             if(CarInfo[car][vGun1] == 0)
  112.             {
  113.                 CarInfo[car][vGun1] = gunid;
  114.                 format(string, sizeof(string), "* Jack takes a weapon and puts it into their car.");
  115.                 ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  116.                 SendClientMessage(playerid, COLOR_LIGHTBLUE, "You have stored a weapon in Slot 1.");
  117.                
  118.                 TakeWeapon(playerid, gunid);
  119.                 return 1;
  120.             }
  121.             else if(CarInfo[car][vGun2] == 0)
  122.             {
  123.                 CarInfo[car][vGun2] = gunid;
  124.                 format(string, sizeof(string), "* Jack takes a weapon and puts it into their car.");
  125.                 ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  126.                 SendClientMessage(playerid, COLOR_LIGHTBLUE, "You have stored a weapon in Slot 2.");
  127.  
  128.                 TakeWeapon(playerid, gunid);
  129.                 return 1;
  130.             }
  131.             else if(CarInfo[car][vGun3] == 0)
  132.             {
  133.                 CarInfo[car][vGun3] = gunid;
  134.                 format(string, sizeof(string), "* Jack takes a weapon and puts it into their car.");
  135.                 ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  136.                 SendClientMessage(playerid, COLOR_LIGHTBLUE, "You have stored a weapon in Slot 3.");
  137.  
  138.                 TakeWeapon(playerid, gunid);
  139.                 return 1;
  140.             }
  141.             else
  142.             {
  143.                 SendClientMessage(playerid, COLOR_GREY, "* You have no weapon space left.");
  144.                 return 1;
  145.             }
  146.         }
  147.         return 1;
  148.     }
  149.     if(strcmp(action, "get") == 0)
  150.     {
  151.         if(strcmp(item, "pot") == 0)
  152.         {
  153.             new pot = CarInfo[car][vPot];
  154.             //if no amount return SendClientMessage(playerid, COLOR_GREY, "* Usuage: /car get pot [amount]");
  155.             if(amount < 0) return SendClientMessage(playerid, COLOR_GREY, "* Usuage: /car get pot [amount]");
  156.             if(amount > pot) return SendClientMessage(playerid, COLOR_GREY, "* Your car does not have that much Pot !");
  157.  
  158.             CarInfo[car][vPot] -= amount;
  159.             format(string, sizeof(string), "* %s takes out something from his vehicle.", PlayerName(playerid));
  160.             ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  161.  
  162.             PlayerInfo[playerid][pPot] += amount;
  163.  
  164.             format(string, sizeof(string), "New amount after taking %d pot: %d", amount, CarInfo[car][vPot]);
  165.             SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
  166.  
  167.             return 1;
  168.         }
  169.  
  170.         if(strcmp(item, "crack") == 0)
  171.         {
  172.             if(!amount) return SendClientMessage(playerid, COLOR_GREY, "* Usuage: /car get crack [amount]");
  173.             if(amount < 0) return SendClientMessage(playerid, COLOR_GREY, "* Usuage: /car get crack [amount]");
  174.  
  175.             new crack = CarInfo[car][vCrack];
  176.  
  177.             if(amount > crack) return SendClientMessage(playerid, COLOR_GREY, "* Your car does not have that much Crack !");
  178.  
  179.             CarInfo[car][vCrack] -= amount;
  180.             format(string, sizeof(string), "* %s takes out something from his vehicle.", PlayerName(playerid));
  181.             ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  182.  
  183.             PlayerInfo[playerid][pCrack] += amount;
  184.  
  185.             format(string, sizeof(string), "  New amount taking adding %d crack: %d", amount, CarInfo[car][vCrack]);
  186.             SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
  187.  
  188.             return 1;
  189.         }
  190.  
  191.         if(strcmp(item, "mats") == 0)
  192.         {
  193.             if(!amount) return SendClientMessage(playerid, COLOR_GREY, "* Usuage: /car get mats [amount]");
  194.             if(amount < 0) return SendClientMessage(playerid, COLOR_GREY, "* Usuage: /car get mats [amount]");
  195.  
  196.             new mats = CarInfo[car][vMats];
  197.  
  198.             if(amount > mats) return SendClientMessage(playerid, COLOR_GREY, "* Your car does not have that many Materials !");
  199.  
  200.             CarInfo[car][vMats] -= amount;
  201.             format(string, sizeof(string), "* %s takes out something from his vehicle.", PlayerName(playerid));
  202.             ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  203.  
  204.             PlayerInfo[playerid][pMats] += amount;
  205.  
  206.             format(string, sizeof(string), "  New amount after taking %d materials: %d", amount, CarInfo[car][vMats]);
  207.             SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
  208.  
  209.             return 1;
  210.         }
  211.        
  212.         if(strcmp(item, "weapon") == 0)
  213.         {
  214.             if(amount == 1)
  215.             {
  216.                 if(CarInfo[car][vGun1] == 0) return SendClientMessage(playerid, COLOR_GREY, "* No weapon in Slot 1.");
  217.  
  218.                 format(string, sizeof(string), "* %s takes a weapon from their car.", PlayerName(playerid));
  219.                 ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  220.            
  221.                 new gunid = CarInfo[car][vGun1];
  222.                
  223.                 CarInfo[car][vGun1] = 0;
  224.  
  225.                 GivePlayerGun(playerid, gunid);
  226.                 SendClientMessage(playerid, COLOR_LIGHTBLUE, "   You taken a weapon from Slot 1.");
  227.  
  228.             }
  229.             if(amount == 2)
  230.             {
  231.                 if(CarInfo[car][vGun2] == 0) return SendClientMessage(playerid, COLOR_GREY, "* No weapon in Slot 2.");
  232.                
  233.                 format(string, sizeof(string), "* %s takes a weapon from their car.", PlayerName(playerid));
  234.                 ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  235.  
  236.                 new gunid = CarInfo[car][vGun2];
  237.                 CarInfo[car][vGun2] = 0;
  238.                
  239.                 GivePlayerGun(playerid, gunid);
  240.                 SendClientMessage(playerid, COLOR_LIGHTBLUE, "   You taken a weapon from Slot 2.");
  241.  
  242.             }
  243.             if(amount == 3)
  244.             {
  245.                 if(CarInfo[car][vGun3] == 0) return SendClientMessage(playerid, COLOR_GREY, "* No weapon in Slot 3.");
  246.                
  247.                 format(string, sizeof(string), "* %s takes a weapon from their car.", PlayerName(playerid));
  248.                 ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  249.  
  250.                 new gunid = CarInfo[car][vGun3];
  251.                
  252.                 CarInfo[car][vGun3] = 0;
  253.  
  254.                 GivePlayerGun(playerid, gunid);
  255.                 SendClientMessage(playerid, COLOR_LIGHTBLUE, "   You taken a weapon from Slot 3.");
  256.                
  257.             }
  258.             else
  259.             {
  260.                 SendClientMessage(playerid, COLOR_GREY, "* Usuage: /car get weapon [1 2 or 3]");
  261.                 return 1;
  262.             }
  263.             return 1;
  264.         }
  265.  
  266.     }
  267.     else return SendClientMessage(playerid, COLOR_GREY, "* Invalid syntax !");
  268.  
  269.     return 1;
  270. }
  271.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement