0% found this document useful (0 votes)
45 views5 pages

Simple Drug System Script for SA-MP

Uploaded by

hakernayan12
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
45 views5 pages

Simple Drug System Script for SA-MP

Uploaded by

hakernayan12
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

/*

|||||||||||||||||||||||||||||||||||||||||||
||Simple Drug System By AlexzzPro ||
||Please keep the credits to me! ||
||Do not re-release without my permission||
|||||||||||||||||||||||||||||||||||||||||||
*/
#include <a_samp>
#include <Dini>
//||<<--Dialogs-->>||//
#define DRUGBUY 1337
#define DRUGUSE 1338
#define ACCEPTDRUG1 1339
#define ACCEPTDRUG2 1400
#define USEHERO 1401
#define USEWEED 1402
//||<<--Important Stuff-->>||//
new heroprice = 1000; // The price of heroine
new weedprice = 1000; // The price of weed
new heroin[MAX_PLAYERS];
new weed[MAX_PLAYERS];
new high[MAX_PLAYERS];
new iDrugBuy;
forward DrugsOff(playerid);
//||<<--Defines & Colours-->>||//
#define FILTERSCRIPT
#if defined FILTERSCRIPT
#define COLOR_YELLOW 0xFFFF00AA
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Simple Drug System By AlexzzPro");
print("--------------------------------------\n");
iDrugBuy = CreatePickup(1318, 23, 1529.6191, -1850.1277, 13.5469);
SetTimer("DrugSave",1,0);
return 1;
}

#endif

public OnPlayerCommandText(playerid, cmdtext[])


{
if (strcmp("/usedrug", cmdtext, true, 10) == 0)
{
if(high[playerid] == 1)
{
SendClientMessage(playerid, COLOR_YELLOW, " You cant use this
command while you are high");
return 1;
}
ShowPlayerDialog(playerid, DRUGUSE, DIALOG_STYLE_LIST, "Use
Drugs","Heroine\nWeed","Use","Close");
return 1;
}
return 0;
}
forward DrugSave(playerid);
public DrugSave(playerid)
{
OnPlayerConnect(playerid);
return 1;
}
public OnPlayerConnect(playerid)
{
new file[100],pName[MAX_PLAYER_NAME];
GetPlayerName(playerid,pName,24);
format(file,sizeof(file),"Drugs\%[Link]",pName);
if(!dini_Exists(file))
{
dini_Create(file);
dini_IntSet(file,"Heroine",heroin[playerid]);
dini_IntSet(file,"Weed",weed[playerid]);
}
else
{
heroin[playerid] = dini_Int(file,"Heroine");
weed[playerid] = dini_Int(file,"Weed");
}
return 1;
}
public OnPlayerPickUpPickup(playerid, pickupid)
{
if(pickupid == iDrugBuy)
{
ShowPlayerDialog(playerid, DRUGBUY, DIALOG_STYLE_LIST,
"Drugs","Heroine[$1000]\nWeed[$1000]","Buy","Close");
return 1;
}
return 1;
}

public DrugsOff(playerid)
{
if(IsPlayerConnected(playerid))
{
SetCameraBehindPlayer(playerid);
SetPlayerDrunkLevel(playerid, 0);
SetPlayerWeather(playerid, 2);
high[playerid] = 0;
}
return 0;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == USEWEED)
{
if(response)
{
new Float:Health,Float:Armour; GetPlayerHealth(playerid,Health);
GetPlayerArmour(playerid,Armour);
SetPlayerArmour(playerid,Armour+15);
weed[playerid] -= 1;
SetPlayerWeather(playerid, -84);
SetPlayerDrunkLevel(playerid, 10000);
SetPlayerTime(playerid,4,00);
high[playerid] = 1;
GameTextForPlayer(playerid, "~r~The drug effect will be gone in a
minute",3500,5);
SetTimerEx("DrugsOff", 60000, false, "i", playerid);
}
if(!response)
{
ShowPlayerDialog(playerid, DRUGUSE, DIALOG_STYLE_LIST, "Use
Drugs","Heroine\nWeed","Use","Close");
}
}
if(dialogid == USEHERO)
{
if(response)
{
new Float:Health,Float:Armour; GetPlayerHealth(playerid,Health);
GetPlayerArmour(playerid,Armour);
heroin[playerid] -= 1;
SetPlayerArmour(playerid,Armour+20);
SetPlayerWeather(playerid, -66);
SetPlayerDrunkLevel(playerid, 10000);
SetPlayerTime(playerid,12,00);
GameTextForPlayer(playerid, "~r~The drug effect will be gone in a
minute",3500,5);
high[playerid] = 1;
SetTimerEx("DrugsOff", 60000, false, "i", playerid);
}
if(!response)
{
ShowPlayerDialog(playerid, DRUGUSE, DIALOG_STYLE_LIST, "Use
Drugs","Heroine\nWeed","Use","Close");
}
}
if(dialogid == DRUGUSE)
{
if(response)
{
if(listitem == 0)
{
if(heroin[playerid] >= 1)
{
ShowPlayerDialog(playerid, USEHERO, DIALOG_STYLE_MSGBOX,
"Heroine","Do you wish to use a gram of heroine?","Yes","No");
}
else
{
SendClientMessage(playerid, COLOR_YELLOW, " You dont
have any heroine");
}
}
if(listitem == 1)
{
if(weed[playerid] >= 1)
{
ShowPlayerDialog(playerid, USEWEED, DIALOG_STYLE_MSGBOX,
"Weed","Do you wish to use a gram of weed?","Yes","No");
}
else
{
SendClientMessage(playerid, COLOR_YELLOW, " You dont
have any weed");
}
}
}
}
if(dialogid == ACCEPTDRUG2)
{
if(response)
{
GivePlayerMoney(playerid, -weedprice);
weed[playerid] += 5;
SendClientMessage(playerid, COLOR_YELLOW, "You purchased 5 grams of
weed for $1000");
SendClientMessage(playerid, COLOR_YELLOW, "HINT: Use /usedrug to
use your drugs");
}
if(!response)
{
SendClientMessage(playerid, COLOR_YELLOW, " Just come back if you
change your mind");
}
}
if(dialogid == ACCEPTDRUG1)
{
if(response)
{
GivePlayerMoney(playerid, -heroprice);
heroin[playerid] += 5;
SendClientMessage(playerid, COLOR_YELLOW, "You purchased 5 grams
of heroine for $1000");
SendClientMessage(playerid, COLOR_YELLOW, "HINT: Use /usedrug to
use your drugs");
}
if(!response)
{
SendClientMessage(playerid, COLOR_YELLOW, " Just come back if you
change your mind");
}
}
if(dialogid == DRUGBUY)
{
if(response)
{
if(listitem == 0)
{
if(GetPlayerMoney(playerid) < 1000) return
SendClientMessage(playerid, COLOR_YELLOW, "You don't have enough money!");
{
ShowPlayerDialog(playerid, ACCEPTDRUG1,
DIALOG_STYLE_MSGBOX, "Heroine","Do you wish to purchase 5 grams of heroine for
{FF0000}$1000?","Yes","No");
}
}
if(listitem == 1)
{
if(GetPlayerMoney(playerid) < 1000) return
SendClientMessage(playerid, COLOR_YELLOW, "You don't have enough money!");
{
ShowPlayerDialog(playerid, ACCEPTDRUG2,
DIALOG_STYLE_MSGBOX, "Weed","Do you wish to purchase 5 grams of weed for
{FF0000}$1000?","Yes","No");
}
}
}
}
return 1;
}

You might also like