Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*Drug System made by Friezakinght
- Current Version: 3.0
- Commands:
- /buydrugs
- /usedrugs
- /mydrugs
- /givedrugs
- /selldrugs
- /acceptdrugs
- /drugcmds
- /setdrugs (only for RCON admins)
- /agivedrugs (only for RCON admins)
- /checkdrugs (only for RCON admins)
- Author/Scripter: friezakinght
- Thanks to:
- Y_Less for - foreach, sscanf, Y_ini
- Zeex for - ZCMD
- You can modify the script how you like, however, please keep the credits.
- This is the final version of the script, thank you for downloading, any minor update would be in work if found any bugs!
- Changelog v3.0:
- Added a message box instead of a text message which shows how much drugs the player have and how much are they worth on the street.
- Added /selldrugs command for players to sell drugs to other players. The value by default is 1000$ per gram - 100$ dealer fee.
- Added /acceptdrugs [dealer id] command for players to accept a dealer's deal.
- Added /drugcmds command to see all of the drug system commands, admins can see all commands + admin commands.
- Now you can /givedrugs and /selldrugs or /acceptdrugs only if you are close to the player you're giving/selling to or accepting from.
- Added 2 more drug types: Opium(30HP) and Meth(15HP)
- Changed Cocaine(80HP), Weed(60HP) and Heroine(50HP) HP value.
- */
- #include <a_samp>
- #include <YSI\y_ini>
- #include <zcmd>
- #include <sscanf2>
- #include <foreach>
- #define USER_FILE "UserDrugs/%s.ini"
- #define DRUG_SHOP_MENU 1
- #define MY_DRUGS_MENU 2
- #define DRUG_COMMANDS_MENU 3
- #define DRUG_GRAM_PRICE 1000
- #define DRUG_DEALER_FEE 100
- #define RED 0xFF0000FF
- #define BLUE 0x999999
- #define WHITE 0xFFFFFFAA
- #define GREEN 0x33AA33AA
- enum PlayerInfo
- {
- pName,
- pDrugs
- }
- new PDrugs[MAX_PLAYERS][PlayerInfo];
- new IsHigh[MAX_PLAYERS];
- new Deal[MAX_PLAYERS];
- new ddprice = DRUG_GRAM_PRICE - DRUG_DEALER_FEE;
- new DDAmount[MAX_PLAYERS];
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------");
- print(" Drug System by friezakinght v2.0");
- print("--------------------------------------\n");
- return 1;
- }
- public OnFilterScriptExit()
- {
- foreach(Player, p)
- {
- if(IsPlayerConnected(p))
- {
- SaveUserDrugStats(p);
- }
- }
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- if(fexist(DrugFilePath(playerid)))
- {
- INI_ParseFile(DrugFilePath(playerid), "LoadDrugData_%s", .bExtra = true, .extra = playerid);
- }
- else
- {
- new playerName[MAX_PLAYER_NAME];
- GetPlayerName(playerid, playerName, MAX_PLAYER_NAME);
- new INI:ufile = INI_Open(DrugFilePath(playerid));
- INI_SetTag(ufile, "general");
- INI_WriteString(ufile, "pName", playerName);
- INI_WriteInt(ufile, "pDrugs", 0);
- INI_Close(ufile);
- }
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- SaveUserDrugStats(playerid);
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- IsHigh[playerid] = 0;
- SetPlayerDrunkLevel(playerid, 0);
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- IsHigh[playerid] = 0;
- SetPlayerWeather(playerid, 1);
- SetPlayerDrunkLevel(playerid, 0);
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- if(dialogid == DRUG_SHOP_MENU && response == 1)
- {
- new dstr[150];
- format(dstr, sizeof(dstr), "{FFFFCC}Enter the amount of {006600}grams {FFFFCC}you would like to {00FF00}buy:{FFFFCC}\nCurrent price per gram: ${00FF00}%d{FFFFCC}", DRUG_GRAM_PRICE);
- if(strlen(inputtext) <= 0) { ShowPlayerDialog(playerid, DRUG_SHOP_MENU, DIALOG_STYLE_INPUT,"{006600}Buy drugs:", dstr, "Buy", "Close"); }
- else if(!DrugAmountIsNumeric(inputtext)) { ShowPlayerDialog(playerid, DRUG_SHOP_MENU, DIALOG_STYLE_INPUT,"{006600}Buy drugs:", dstr, "Buy", "Close"); }
- else
- {
- new
- pcash = GetPlayerMoney(playerid),
- str[128],
- amount = strval(inputtext),
- cash = amount * DRUG_GRAM_PRICE;
- if(amount <= 500)
- {
- if(pcash >= cash)
- {
- GivePlayerMoney(playerid, - cash);
- format(str, sizeof(str), "You bought {00FF00}%d {FFFFFF}grams of drugs for {00FF00}$%d{FFFFFF}.", amount, cash);
- SendClientMessage(playerid, -1, str);
- PDrugs[playerid][pDrugs] += amount;
- SaveUserDrugStats(playerid);
- }
- else
- {
- format(str, sizeof(str), "You don't have enough money for %dg of drugs!", amount);
- SendClientMessage(playerid, RED, str);
- }
- }
- else
- {
- format(str, sizeof(str), "You cannot buy more than 500g of drugs per purchase!");
- SendClientMessage(playerid, RED, str);
- }
- }
- }
- return 1;
- }
- CMD:buydrugs(playerid, params[])
- {
- if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, -1, "You need to be connected to buy drugs!");
- new dstr[150];
- format(dstr, sizeof(dstr), "{FFFFCC}Enter the amount of {006600}grams {FFFFCC}you would like to {00FF00}buy:{FFFFCC}\nCurrent price per gram: ${00FF00}%d{FFFFCC}", DRUG_GRAM_PRICE);
- ShowPlayerDialog(playerid, DRUG_SHOP_MENU, DIALOG_STYLE_INPUT,"{006600}Buy drugs:", dstr, "Buy", "Close");
- return true;
- }
- CMD:usedrugs(playerid, params[])
- {
- if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, BLUE, "You're not even connected to the server.");
- if(IsHigh[playerid] == 1) return SendClientMessage(playerid, BLUE, "You're already high!" );
- if(PDrugs[playerid][pDrugs] == 0) return SendClientMessage(playerid, BLUE, "You don't have a gram of drugs");
- new drugname[32];
- if(sscanf(params,"s[32]",drugname))
- {
- SendClientMessage(playerid, BLUE, "USAGE: /usedrugs [drugname/number]");
- SendClientMessage(playerid, BLUE, "CHOICES: Cocaine [1](80HP), Weed [2](60HP), Heroine [3](50HP), Opium[4](30HP), Meth[5](15HP).");
- return 1;
- }
- new Float:PHealth;
- if(strcmp(drugname, "cocaine", true) == 0 || strcmp(drugname, "1", true) == 0)
- {
- GetPlayerHealth(playerid, PHealth);
- if(PDrugs[playerid][pDrugs] >= 5)
- {
- SetPlayerWeather(playerid, -66);
- SetPlayerDrunkLevel(playerid, 4999);
- SetPlayerTime(playerid,12,00);
- GameTextForPlayer(playerid, "~r~The drug effect will be gone in a minute", 3000, 5);
- IsHigh[playerid] = 1;
- PDrugs[playerid][pDrugs] -= 5;
- SaveUserDrugStats(playerid);
- SendClientMessage(playerid, WHITE, "You snorted 5g of cocaine.");
- SetTimer("IsHighTimer", 120000, false);
- if(PHealth <= 80)
- {
- GivePlayerHealth(playerid, 20);
- }
- else
- {
- SetPlayerHealth(playerid, 100);
- }
- }
- else
- {
- SendClientMessage(playerid, BLUE, "You need 5g of drugs to snort cocaine.");
- }
- }
- if(strcmp(drugname, "weed", true) == 0 || strcmp(drugname, "2", true) == 0)
- {
- if(PDrugs[playerid][pDrugs] >= 4)
- {
- GetPlayerHealth(playerid, PHealth);
- SetPlayerWeather(playerid, -66);
- SetPlayerDrunkLevel(playerid, 4750);
- SetPlayerTime(playerid,12,00);
- GameTextForPlayer(playerid, "~r~The drug effect will be gone in a minute", 3000, 5);
- IsHigh[playerid] = 1;
- PDrugs[playerid][pDrugs] -= 4;
- SaveUserDrugStats(playerid);
- SetPlayerSpecialAction(playerid, SPECIAL_ACTION_SMOKE_CIGGY);
- SendClientMessage(playerid, WHITE, "You lit a joint and started smoking.");
- SetTimer("IsHighTimer", 120000, false);
- if(PHealth <= 60)
- {
- GivePlayerHealth(playerid, 60);
- }
- else
- {
- SetPlayerHealth(playerid, 100);
- }
- }
- else
- {
- SendClientMessage(playerid, BLUE, "You need 4g of drugs to smoke weed.");
- }
- }
- if(strcmp(drugname, "heroine", true) == 0 || strcmp(drugname, "3", true) == 0)
- {
- if(PDrugs[playerid][pDrugs] >= 3)
- {
- SetPlayerWeather(playerid, -66);
- SetPlayerDrunkLevel(playerid, 4500);
- SetPlayerTime(playerid,12,00);
- GameTextForPlayer(playerid, "~r~The drug effect will be gone in a minute", 3000, 5);
- IsHigh[playerid] = 1;
- PDrugs[playerid][pDrugs] -= 3;
- SaveUserDrugStats(playerid);
- SendClientMessage(playerid, WHITE, "You injected 3g of heroine into your veins.");
- SetTimer("IsHighTimer", 120000, false);
- if(PHealth <= 50)
- {
- GivePlayerHealth(playerid, 50);
- }
- else
- {
- SetPlayerHealth(playerid, 100);
- }
- }
- else
- {
- SendClientMessage(playerid, BLUE, "You need 3g of drugs to inject heroine.");
- }
- }
- if(strcmp(drugname, "opium", true) == 0 || strcmp(drugname, "4", true) == 0)
- {
- if(PDrugs[playerid][pDrugs] >= 2)
- {
- SetPlayerWeather(playerid, -66);
- SetPlayerDrunkLevel(playerid, 4500);
- SetPlayerTime(playerid,12,00);
- GameTextForPlayer(playerid, "~r~The drug effect will be gone in a minute", 3000, 5);
- IsHigh[playerid] = 1;
- PDrugs[playerid][pDrugs] -= 2;
- SaveUserDrugStats(playerid);
- SendClientMessage(playerid, WHITE, "You took a pipe from your pocket and you started smoking Opium.");
- SetTimer("IsHighTimer", 120000, false);
- if(PHealth <= 30)
- {
- GivePlayerHealth(playerid, 30);
- }
- else if(PHealth >= 70)
- {
- SetPlayerHealth(playerid, 100);
- }
- else if(PHealth > 30)
- {
- GivePlayerHealth(playerid, 30);
- }
- }
- else
- {
- SendClientMessage(playerid, BLUE, "You need 2g of drugs to smoke Opium.");
- }
- }
- if(strcmp(drugname, "meth", true) == 0 || strcmp(drugname, "5", true) == 0)
- {
- if(PDrugs[playerid][pDrugs] >= 1)
- {
- SetPlayerWeather(playerid, -66);
- SetPlayerDrunkLevel(playerid, 4500);
- SetPlayerTime(playerid,12,00);
- GameTextForPlayer(playerid, "~r~The drug effect will be gone in a minute", 3000, 5);
- IsHigh[playerid] = 1;
- PDrugs[playerid][pDrugs] -= 1;
- SaveUserDrugStats(playerid);
- SendClientMessage(playerid, WHITE, "You snorted 1g of Meth Powder.");
- SetTimer("IsHighTimer", 120000, false);
- if(PHealth <= 15)
- {
- GivePlayerHealth(playerid, 15);
- }
- else if(PHealth >= 85)
- {
- SetPlayerHealth(playerid, 100);
- }
- else if(PHealth > 15)
- {
- GivePlayerHealth(playerid, 15);
- }
- }
- else
- {
- SendClientMessage(playerid, BLUE, "You need 1g of Meth to snort Meth Powder.");
- }
- }
- return 1;
- }
- CMD:mydrugs(playerid, params[])
- {
- new pdrg = PDrugs[playerid][pDrugs];
- new dprice = DRUG_GRAM_PRICE;
- new dfee = pdrg * DRUG_DEALER_FEE;
- new dworth = pdrg * dprice - dfee;
- new dstr[150];
- format(dstr, sizeof(dstr), "{FFFFCC}Drugs: {00FF00}%d{FFFFCC}g\n{FFFFCC}Drugs worth: {00FF00}$%d", PDrugs[playerid][pDrugs], dworth);
- ShowPlayerDialog(playerid, MY_DRUGS_MENU, DIALOG_STYLE_MSGBOX,"{006600}Your drug stats:", dstr, "Ok", "");
- return 1;
- }
- CMD:setdrugs(playerid, params[])
- {
- new fstr[200];
- new damount, id;
- if(sscanf(params, "ud", id, damount)) return SendClientMessage(playerid, RED, "[USAGE]: /setdrugs [player id] [amount]");
- if(!IsPlayerConnected(id)) return SendClientMessage(playerid, RED, "Player not found.");
- if(IsPlayerAdmin(playerid))
- {
- PDrugs[id][pDrugs] = damount;
- PlayerPlaySound(id,1085,0.0,0.0,0.0);
- format(fstr, sizeof(fstr), "You have set %s [%d] drug amount to {00FF00}%d{FFFFFF}.", GetName(id), id, damount);
- SendClientMessage(playerid, WHITE, fstr);
- format(fstr, sizeof(fstr), "Admin %s [%d] has set your drug amount to {00FF00}%d{FFFFFF}.", GetName(playerid), playerid, damount);
- SendClientMessage(id, WHITE, fstr);
- SaveUserDrugStats(id);
- }
- else
- {
- SendClientMessage(playerid, RED, "You don't have the permission to acces this command!");
- }
- return true;
- }
- CMD:givedrugs(playerid, params[])
- {
- new fstr[200], fstr2[80];
- new damount, id;
- if(sscanf(params, "ud", id, damount)) return SendClientMessage(playerid, RED, "[USAGE]: /givedrugs [player id] [amount]");
- format(fstr2, sizeof(fstr2), "%s [%d] is not close enough.", GetName(id), id);
- if(!IsPlayerConnected(id)) return SendClientMessage(playerid, RED, "Player not found.");
- if(!ProxDetectorS(5.0, playerid, id)) return SendClientMessage(playerid, RED, fstr2);
- if(PDrugs[playerid][pDrugs] >= damount)
- {
- PDrugs[id][pDrugs] += damount;
- PDrugs[playerid][pDrugs] -= damount;
- PlayerPlaySound(id,1085,0.0,0.0,0.0);
- format(fstr, sizeof(fstr), "You have given %s [%d] {00FF00}%d{FFFFFF} drug grams.", GetName(id), id, damount);
- SendClientMessage(playerid, WHITE, fstr);
- format(fstr, sizeof(fstr), "%s [%d] has given you {00FF00}%d{FFFFFF} grams of drugs.", GetName(playerid), playerid, damount);
- SendClientMessage(id, WHITE, fstr);
- SaveUserDrugStats(id);
- SaveUserDrugStats(playerid);
- }
- else
- {
- SendClientMessage(playerid, RED, "You don't have enough grams of drugs!");
- }
- return true;
- }
- CMD:selldrugs(playerid, params[])
- {
- new fstr[200], fstr2[200], fstr3[64];
- new damount, id;
- if(sscanf(params, "ud", id, damount)) return SendClientMessage(playerid, RED, "[USAGE]: /selldrugs [player id] [amount]");
- format(fstr3, sizeof(fstr3), "%s [%d] is not close enough", GetName(id), id);
- if(!IsPlayerConnected(id)) return SendClientMessage(playerid, RED, "Player not found.");
- if(!ProxDetectorS(5.0, playerid, id)) return SendClientMessage(playerid, RED, fstr3);
- if(id == playerid) return SendClientMessage(playerid, RED, "You can't sell drugs to yourself!");
- if(damount > 0 && damount <= 500)
- {
- if(PDrugs[playerid][pDrugs] >= damount)
- {
- new dworth = damount * ddprice;
- PlayerPlaySound(id,1085,0.0,0.0,0.0);
- format(fstr, sizeof(fstr), "You offered %s [%d] {00FF00}%d{FFFFFF} grams of drugs for {00FF00}%d{FFFFFF}, wait until they accept the deal.", GetName(id), id, damount, dworth);
- SendClientMessage(playerid, WHITE, fstr);
- format(fstr, sizeof(fstr), "%s [%d] wants to sell {00FF00}%d{FFFFFF} grams of drugs to you for {00FF00}%d{FFFFFF}.", GetName(playerid), playerid, damount, dworth);
- SendClientMessage(id, WHITE, fstr);
- format(fstr2, sizeof(fstr2), "Type {0099CC}/acceptdrugs %d{FFFFFF} to accept the deal, the command will expire in {CC0000}45 seconds{FFFFFF}.", playerid);
- SendClientMessage(id, WHITE, fstr2);
- SetTimer("DealTimer", 45000, false);
- Deal[id] = 1;
- Deal[playerid] = 1;
- DDAmount[playerid] = damount;
- }
- else
- {
- SendClientMessage(playerid, RED, "You don't have enough grams of drugs!");
- }
- }
- else
- {
- SendClientMessage(playerid, RED, "You need to insert an amount between 1 and 500!");
- }
- return true;
- }
- CMD:acceptdrugs(playerid, params[])
- {
- new msg[200], msg2[128], msg3[64];
- new id;
- if(sscanf(params, "u", id)) return SendClientMessage(playerid, RED, "[USAGE]: /acceptdrugs [dealer id]");
- format(msg3, sizeof(msg3), "%s [%d] is not close enough", GetName(id), id);
- if(!IsPlayerConnected(id)) return SendClientMessage(playerid, RED, "Dealer not found.");
- if(!ProxDetectorS(5.0, playerid, id)) return SendClientMessage(playerid, RED, msg3);
- new pcash = GetPlayerMoney(playerid);
- new dworth = DDAmount[id] * ddprice;
- if(pcash >= dworth)
- {
- if(Deal[playerid] == 1 && Deal[id] == 1)
- {
- PDrugs[playerid][pDrugs] += DDAmount[id];
- PDrugs[id][pDrugs] -= DDAmount[id];
- GivePlayerMoney(id, dworth);
- GivePlayerMoney(playerid, - dworth);
- format(msg, sizeof(msg), "You sold {00FF00}%d{FFFFFF} grams of drugs to %s [%d] for {00FF00}$%d{FFFFFF}.", DDAmount[id], GetName(playerid), playerid, dworth);
- SendClientMessage(id, WHITE, msg);
- format(msg2, sizeof(msg2), "You bought {00FF00}%d{FFFFFF} grams of drugs from %s [%d] for {00FF00}$%d{FFFFFF}.", DDAmount[id], GetName(id), id, dworth);
- SendClientMessage(playerid, WHITE, msg2);
- Deal[id] = 0;
- Deal[playerid] = 0;
- SaveUserDrugStats(id);
- SaveUserDrugStats(playerid);
- }
- else
- {
- SendClientMessage(playerid, RED, "That dealer hasn't offered you any drugs!");
- }
- }
- else
- {
- SendClientMessage(playerid, RED, "You don't have enough cash!");
- }
- return true;
- }
- CMD:agivedrugs(playerid, params[])
- {
- new fstr[200];
- new damount, id;
- if(sscanf(params, "ud", id, damount)) return SendClientMessage(playerid, RED, "[USAGE]: /agivedrugs [player id] [amount]");
- if(!IsPlayerConnected(id)) return SendClientMessage(playerid, RED, "Player not found.");
- if(IsPlayerAdmin(playerid))
- {
- PDrugs[id][pDrugs] += damount;
- PlayerPlaySound(id,1085,0.0,0.0,0.0);
- format(fstr, sizeof(fstr), "You have given %s [%d] {00FF00}%d{FFFFFF} drug grams.", GetName(id), id, damount);
- SendClientMessage(playerid, WHITE, fstr);
- format(fstr, sizeof(fstr), "Admin %s [%d] has given you {00FF00}%d{FFFFFF} grams of drugs.", GetName(playerid), playerid, damount);
- SendClientMessage(id, WHITE, fstr);
- SaveUserDrugStats(id);
- }
- else
- {
- SendClientMessage(playerid, RED, "You don't have the permission to acces this command!");
- }
- return true;
- }
- CMD:checkdrugs(playerid, params[])
- {
- new id;
- if(sscanf(params, "u", id)) return SendClientMessage(playerid, RED, "[USAGE]: /checkdrugs [player id]");
- if(!IsPlayerConnected(id)) return SendClientMessage(playerid, RED, "Player not found.");
- if(IsPlayerAdmin(playerid))
- {
- new pdrg = PDrugs[id][pDrugs];
- new dprice = DRUG_GRAM_PRICE;
- new dfee = pdrg * DRUG_DEALER_FEE;
- new dworth = pdrg * dprice - dfee;
- new dstr[150], dstrt[48];
- format(dstr, sizeof(dstr), "{FFFFCC}Drugs: {00FF00}%d{FFFFCC}g\n{FFFFCC}Drugs worth: {00FF00}$%d", PDrugs[id][pDrugs], dworth);
- format(dstrt, sizeof(dstrt), "{006600}%s's [%d] drug stats:", GetName(id), id);
- ShowPlayerDialog(playerid, MY_DRUGS_MENU, DIALOG_STYLE_MSGBOX, dstrt, dstr, "Ok", "");
- }
- else
- {
- SendClientMessage(playerid, RED, "You don't have the permission to acces this command!");
- }
- return true;
- }
- CMD:drugcmds(playerid, params[])
- {
- if(IsPlayerAdmin(playerid))
- {
- new dstr[1024];
- format(dstr, sizeof(dstr), "{FFFFCC}Commands: \n/buydrugs - Buy drugs. Price: {00FF00}$%d{FFFFCC}/g\n/usedrugs - Use the drugs you have\n/mydrugs - See how much drugs you have and how much are they worth on the streets\n/givedrugs - Give drugs to another player\n/selldrugs - Sell drugs to another player\n/acceptdrugs - Accept a drug dealer's offer\n/setdrugs\n/agivedrugs\n/checkdrugs", DRUG_GRAM_PRICE);
- ShowPlayerDialog(playerid, MY_DRUGS_MENU, DIALOG_STYLE_MSGBOX,"{006600}Drug System Commands:", dstr, "Ok", "");
- }
- else
- {
- new dstr[1024];
- format(dstr, sizeof(dstr), "{FFFFCC}Commands: \n/buydrugs - Buy drugs. Price: {00FF00}$%d{FFFFCC}/g\n/usedrugs - Use the drugs you have\n/mydrugs - See how much drugs you have and how much are they worth on the streets\n/givedrugs - Give drugs to another player\n/selldrugs - Sell drugs to another player\n/acceptdrugs - Accept a drug dealer's offer", DRUG_GRAM_PRICE);
- ShowPlayerDialog(playerid, MY_DRUGS_MENU, DIALOG_STYLE_MSGBOX,"{006600}Drug System Commands:", dstr, "Ok", "");
- }
- return true;
- }
- stock SaveUserDrugStats(playerid)
- {
- if(IsPlayerConnected(playerid))
- {
- new playerName[MAX_PLAYER_NAME];
- GetPlayerName(playerid, playerName, MAX_PLAYER_NAME);
- new file[40];
- format(file, sizeof(file), USER_FILE, playerName);
- new INI:ufile = INI_Open(file);
- INI_SetTag(ufile, "general");
- INI_WriteString(ufile, "pName", playerName);
- INI_WriteInt(ufile, "pDrugs", PDrugs[playerid][pDrugs]);
- INI_Close(ufile);
- }
- return 1;
- }
- forward LoadDrugData_general(playerid, name[], value[]);
- public LoadDrugData_general(playerid, name[], value[])
- {
- INI_Int("pName", PDrugs[playerid][pName]);
- INI_Int("pDrugs", PDrugs[playerid][pDrugs]);
- return 1;
- }
- forward IsHighTimer(playerid);
- public IsHighTimer(playerid)
- {
- IsHigh[playerid] = 0;
- SetPlayerWeather(playerid, 1);
- SetPlayerDrunkLevel(playerid, 0);
- }
- forward DealTimer(playerid);
- public DealTimer(playerid)
- {
- Deal[playerid] = 0;
- }
- forward ProxDetectorS(Float:radi, playerid, targetid);
- public ProxDetectorS(Float:radi, playerid, targetid)
- {
- if(IsPlayerConnected(playerid)&&IsPlayerConnected(targetid))
- {
- new Float:posx, Float:posy, Float:posz;
- new Float:oldposx, Float:oldposy, Float:oldposz;
- new Float:tempposx, Float:tempposy, Float:tempposz;
- GetPlayerPos(playerid, oldposx, oldposy, oldposz);
- GetPlayerPos(targetid, posx, posy, posz);
- tempposx = (oldposx -posx);
- tempposy = (oldposy -posy);
- tempposz = (oldposz -posz);
- if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
- {
- return 1;
- }
- }
- return 0;
- }
- stock DrugAmountIsNumeric(const string[])
- {
- new i;
- while(string[i] != '\0') //end of string
- {
- if (string[i] > '9' || string[i] < '0'){return 0;}
- i++;
- }
- return 1;
- }
- stock GivePlayerHealth(playerid,Float:Health)
- {
- new Float:health; GetPlayerHealth(playerid,health);
- SetPlayerHealth(playerid,health+Health);
- }
- stock GetName(playerid)
- {
- new Name[24];
- GetPlayerName(playerid, (Name), sizeof(Name));
- return Name;
- }
- stock DrugFilePath(playerid)
- {
- new string[128],playername[MAX_PLAYER_NAME];
- GetPlayerName(playerid,playername,sizeof(playername));
- format(string,sizeof(string),USER_FILE,playername);
- return string;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement