Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- dcmd_car(playerid, params[])
- {
- if(PlayerInfo[playerid][pOwnsCar] == 0) return SendClientMessage(playerid, COLOR_GREY, "* You do not own a vehicle!");
- new car, vehicle,string[126];
- car = PlayerInfo[playerid][pVehicle];
- vehicle = CarInfo[car][ownedvehicle];
- new action[128], item[128], amount;
- if(sscanf(params, "s[128]S[128]D", action, item, amount))
- {
- SendClientMessage(playerid, COLOR_GREY, "* Usuage: /car [syntax]");
- SendClientMessage(playerid, COLOR_GRAD2, "* Syntax: Check");
- SendClientMessage(playerid, COLOR_GRAD3, "* Syntax: Put - pot crack mats weapon");
- SendClientMessage(playerid, COLOR_GRAD4, "* Syntax: Get - pot crack mats weapon");
- return 1;
- }
- new Float:X, Float:Y, Float:Z;
- GetVehiclePos(vehicle, X, Y, Z);
- if(!IsPlayerInRangeOfPoint(playerid, 5.0, X, Y, Z)) return SendClientMessage(playerid, COLOR_GREY, "* You are not close enough to your vehicle.");
- if(strcmp(action, "check") == 0)
- {
- new pot, crack, mats;
- pot = CarInfo[car][vPot], crack = CarInfo[car][vCrack], mats = CarInfo[car][vMats];
- SendClientMessage(playerid, COLOR_GREY, "__________ Car Storage __________");
- format(string, sizeof(string), "Crack: %d - Pot: %d - Materials: %d", crack, pot, mats);
- DisplayCarGuns(playerid);
- SendClientMessage(playerid, COLOR_GRAD2, string);
- return 1;
- }
- if(strcmp(action, "put") == 0)
- {
- if(strcmp(item, "pot") == 0)
- {
- if(amount < 0) return SendClientMessage(playerid, COLOR_GREY, "* Usuage: /car put pot [amount]");
- new pot = PlayerInfo[playerid][pPot];
- if(amount > pot) return SendClientMessage(playerid, COLOR_GREY, "* You do not have that much Pot !");
- CarInfo[car][vPot] += amount;
- format(string, sizeof(string), "* %s takes out something from his pocket and stores it into his vehicle.", PlayerName(playerid));
- ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
- PlayerInfo[playerid][pPot] -= amount;
- format(string, sizeof(string), "New amount after adding %d pot: %d", amount, CarInfo[car][vPot]);
- SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
- return 1;
- }
- if(strcmp(item, "crack") == 0)
- {
- if(!amount) return SendClientMessage(playerid, COLOR_GREY, "* Usuage: /car put crack [amount]");
- if(amount < 0) return SendClientMessage(playerid, COLOR_GREY, "* Usuage: /car put crack [amount]");
- new crack = PlayerInfo[playerid][pCrack];
- if(amount > crack) return SendClientMessage(playerid, COLOR_GREY, "* You do not have that much Crack !");
- CarInfo[car][vCrack] += amount;
- format(string, sizeof(string), "* %s takes out something from his pocket and stores it into his vehicle.", PlayerName(playerid));
- ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
- PlayerInfo[playerid][pCrack] -= amount;
- format(string, sizeof(string), " New amount after adding %d crack: %d", amount, CarInfo[car][vCrack]);
- SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
- return 1;
- }
- if(strcmp(item, "mats") == 0)
- {
- if(!amount) return SendClientMessage(playerid, COLOR_GREY, "* Usuage: /car put mats [amount]");
- if(amount < 0) return SendClientMessage(playerid, COLOR_GREY, "* Usuage: /car put mats [amount]");
- new mats = PlayerInfo[playerid][pMats];
- if(amount > mats) return SendClientMessage(playerid, COLOR_GREY, "* You do not have that many Materials !");
- CarInfo[car][vMats] += amount;
- format(string, sizeof(string), "* %s takes out something from his pocket and stores it into his vehicle.", PlayerName(playerid));
- ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
- PlayerInfo[playerid][pMats] -= amount;
- format(string, sizeof(string), " New amount after adding %d materials: %d", amount, CarInfo[car][vMats]);
- SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
- return 1;
- }
- if(strcmp(item, "weapon") == 0)
- {
- new gunid = GetPlayerWeapon(playerid);
- if(gunid == 0)
- {
- SendClientMessage(playerid, COLOR_GREY, "* You are not holding a weapon.");
- return 1;
- }
- if(CarInfo[car][vGun1] == 0)
- {
- CarInfo[car][vGun1] = gunid;
- format(string, sizeof(string), "* Jack takes a weapon and puts it into their car.");
- ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
- SendClientMessage(playerid, COLOR_LIGHTBLUE, "You have stored a weapon in Slot 1.");
- TakeWeapon(playerid, gunid);
- return 1;
- }
- else if(CarInfo[car][vGun2] == 0)
- {
- CarInfo[car][vGun2] = gunid;
- format(string, sizeof(string), "* Jack takes a weapon and puts it into their car.");
- ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
- SendClientMessage(playerid, COLOR_LIGHTBLUE, "You have stored a weapon in Slot 2.");
- TakeWeapon(playerid, gunid);
- return 1;
- }
- else if(CarInfo[car][vGun3] == 0)
- {
- CarInfo[car][vGun3] = gunid;
- format(string, sizeof(string), "* Jack takes a weapon and puts it into their car.");
- ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
- SendClientMessage(playerid, COLOR_LIGHTBLUE, "You have stored a weapon in Slot 3.");
- TakeWeapon(playerid, gunid);
- return 1;
- }
- else
- {
- SendClientMessage(playerid, COLOR_GREY, "* You have no weapon space left.");
- return 1;
- }
- }
- return 1;
- }
- if(strcmp(action, "get") == 0)
- {
- if(strcmp(item, "pot") == 0)
- {
- new pot = CarInfo[car][vPot];
- //if no amount return SendClientMessage(playerid, COLOR_GREY, "* Usuage: /car get pot [amount]");
- if(amount < 0) return SendClientMessage(playerid, COLOR_GREY, "* Usuage: /car get pot [amount]");
- if(amount > pot) return SendClientMessage(playerid, COLOR_GREY, "* Your car does not have that much Pot !");
- CarInfo[car][vPot] -= amount;
- format(string, sizeof(string), "* %s takes out something from his vehicle.", PlayerName(playerid));
- ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
- PlayerInfo[playerid][pPot] += amount;
- format(string, sizeof(string), "New amount after taking %d pot: %d", amount, CarInfo[car][vPot]);
- SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
- return 1;
- }
- if(strcmp(item, "crack") == 0)
- {
- if(!amount) return SendClientMessage(playerid, COLOR_GREY, "* Usuage: /car get crack [amount]");
- if(amount < 0) return SendClientMessage(playerid, COLOR_GREY, "* Usuage: /car get crack [amount]");
- new crack = CarInfo[car][vCrack];
- if(amount > crack) return SendClientMessage(playerid, COLOR_GREY, "* Your car does not have that much Crack !");
- CarInfo[car][vCrack] -= amount;
- format(string, sizeof(string), "* %s takes out something from his vehicle.", PlayerName(playerid));
- ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
- PlayerInfo[playerid][pCrack] += amount;
- format(string, sizeof(string), " New amount taking adding %d crack: %d", amount, CarInfo[car][vCrack]);
- SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
- return 1;
- }
- if(strcmp(item, "mats") == 0)
- {
- if(!amount) return SendClientMessage(playerid, COLOR_GREY, "* Usuage: /car get mats [amount]");
- if(amount < 0) return SendClientMessage(playerid, COLOR_GREY, "* Usuage: /car get mats [amount]");
- new mats = CarInfo[car][vMats];
- if(amount > mats) return SendClientMessage(playerid, COLOR_GREY, "* Your car does not have that many Materials !");
- CarInfo[car][vMats] -= amount;
- format(string, sizeof(string), "* %s takes out something from his vehicle.", PlayerName(playerid));
- ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
- PlayerInfo[playerid][pMats] += amount;
- format(string, sizeof(string), " New amount after taking %d materials: %d", amount, CarInfo[car][vMats]);
- SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
- return 1;
- }
- if(strcmp(item, "weapon") == 0)
- {
- if(amount == 1)
- {
- if(CarInfo[car][vGun1] == 0) return SendClientMessage(playerid, COLOR_GREY, "* No weapon in Slot 1.");
- format(string, sizeof(string), "* %s takes a weapon from their car.", PlayerName(playerid));
- ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
- new gunid = CarInfo[car][vGun1];
- CarInfo[car][vGun1] = 0;
- GivePlayerGun(playerid, gunid);
- SendClientMessage(playerid, COLOR_LIGHTBLUE, " You taken a weapon from Slot 1.");
- }
- if(amount == 2)
- {
- if(CarInfo[car][vGun2] == 0) return SendClientMessage(playerid, COLOR_GREY, "* No weapon in Slot 2.");
- format(string, sizeof(string), "* %s takes a weapon from their car.", PlayerName(playerid));
- ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
- new gunid = CarInfo[car][vGun2];
- CarInfo[car][vGun2] = 0;
- GivePlayerGun(playerid, gunid);
- SendClientMessage(playerid, COLOR_LIGHTBLUE, " You taken a weapon from Slot 2.");
- }
- if(amount == 3)
- {
- if(CarInfo[car][vGun3] == 0) return SendClientMessage(playerid, COLOR_GREY, "* No weapon in Slot 3.");
- format(string, sizeof(string), "* %s takes a weapon from their car.", PlayerName(playerid));
- ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
- new gunid = CarInfo[car][vGun3];
- CarInfo[car][vGun3] = 0;
- GivePlayerGun(playerid, gunid);
- SendClientMessage(playerid, COLOR_LIGHTBLUE, " You taken a weapon from Slot 3.");
- }
- else
- {
- SendClientMessage(playerid, COLOR_GREY, "* Usuage: /car get weapon [1 2 or 3]");
- return 1;
- }
- return 1;
- }
- }
- else return SendClientMessage(playerid, COLOR_GREY, "* Invalid syntax !");
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement