pawn Код:
#include <a_samp>
#include <zcmd>
#include <dudb>
#include <dini>
#include <dutils>
#define COLOR_LOCALMSG 0xEC5413AA
#define COLOR_BLUE 0x0000FFAA
#define COLOR_AQUA 0x00FFFFAA
#define COLOR_ADMINCMD 0xF97804FF
#define COLOR_ADMINDUTY 0x007E96F6
#define COLOR_NOTLOGGED 0x00000000
#define COLOR_GRAD1 0xB4B5B7FF
#define COLOR_GRAD2 0xBFC0C2FF
#define COLOR_MONEYBAR 0x005800FF
#define COLOR_GRAD3 0xCBCCCEFF
#define COLOR_GRAD4 0xD8D8D8FF
#define COLOR_GRAD5 0xE3E3E3FF
#define COLOR_GRAD6 0xF0F0F0FF
#define COLOR_GREY 0xAFAFAFAA
#define COLOR_GREEN
#define COLOR_DARKRED 0xCD000000
#define COLOR_ANTICHEAT 0xAA3333AA
#define COLOR_LIGHTBLUE 0x33CCFFAA
#define COLOR_LIGHTGREEN 0x9ACD32AA
#define COLOR_LIGHTRED 0xFF6347AA
#define COLOR_LIGHTBLUE 0x33CCFFAA
#define COLOR_LIGHTBLUE2 0x0080FFAA
#define COLOR_LIGHTGREEN 0x9ACD32AA
#define COLOR_LIGHTORANGE 0xFF8000FF
#define COLOR_DARKBROWN 0xB36C42FF
#define COLOR_MEDIUMBLUE 0x1ED5C7FF
#define COLOR_LIGHTYELLOW 0xE0E377AA
#define COLOR_LIGHTYELLOW2 0xE0EA64AA
#define COLOR_LIGHTYELLOW3 0xFF6347AA
#define COLOR_DARKPURPLE 0x5F56F8AA
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_YELLOW2 0xF5DEB3AA
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_FADE1 0xE6E6E6E6
#define COLOR_FADE2 0xC8C8C8C8
#define COLOR_FADE3 0xAAAAAAAA
#define COLOR_FADE4 0x8C8C8C8C
#define COLOR_FADE5 0x6E6E6E6E
#define COLOR_PURPLE 0xC2A2DAAA
#define COLOR_DBLUE 0x2641FEAA
#define COLOR_ALLDEPT 0xFF8282AA
#define COLOR_NEWS 0xFFA500AA
#define COLOR_OOC 0xE0FFFFAA
#define COLOR_NEWOOC 0x0080FFAA
#define COLOR_RED 0xFF0000FF
new Seeds[MAX_PLAYERS];
new Weed[MAX_PLAYERS];
new FakeWeed[MAX_PLAYERS];
new Heroin[MAX_PLAYERS];
new FakeHeroin[MAX_PLAYERS];
new plantou;
forward WeedGrow(playerid);
forward HeroinGrow(playerid);
forward TimerPlantou();
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Drugs system by Rumen98");
print("--------------------------------------\n");
return 1;
}
CMD:buyseed(playerid, params[])
{
if (Seeds[playerid] == 0) {
if (GetPlayerMoney(playerid) < 50)
return SendClientMessage(playerid, COLOR_RED, "You don't have enough money.");
SendClientMessage(playerid, COLOR_GREEN, "Thank you for buying 1 seed.");
GivePlayerMoney(playerid, -50);
Seeds[playerid] = 1;
} else {
SendClientMessage(playerid, COLOR_RED, "[ERROR:] You already have planted a seed, wait until it finished growing!");
}
return 1;
}
CMD:plantweed(playerid, params[])
{
if(IsPlayerInRangeOfPoint(playerid, 5.0,2542.60009766,-1587.80004883,22.00000000))
if(plantou == 1) return SendClientMessage(playerid, 0xFF8282AA, " Seems someone already planted here, wait some more time."); // Comeзo do Comando
plantou = 1;
SetTimer("TimerPlantou",300000,true);
if(Seeds[playerid] == 1) {
SendClientMessage(playerid, COLOR_GREEN, "You plant 1 weed seed!");
SetTimerEx("WeedGrow", 120000, 0, "i", playerid);
Seeds[playerid] = 0;
} else {
SendClientMessage(playerid, COLOR_RED, "[ERROR:] You don't have enough seeds!");
}
return 1;
}
CMD:plantheroin(playerid, params[])
{
if (Seeds[playerid] == 1) {
SendClientMessage(playerid, COLOR_GREEN, "You plant 1 heroin seed!");
SetTimerEx("HeroinGrow", 10000, 0, "i", playerid);
Seeds[playerid] = 0;
new Float:x, Float:y, Float:z, Float:a;
GetPlayerFacingAngle(playerid, a);
GetPlayerPos(playerid, x, y, z);
Seeds[playerid] = CreateObject(3409, x, y, z - 1.3, 0.0, 0.0, a + 90);
} else {
SendClientMessage(playerid, COLOR_RED, "[ERROR:] You don't have enough seeds!");
}
return 1;
}
CMD:takeweed(playerid, params[])
{
new Float:x, Float:y, Float:z, Float:a;
if (FakeWeed[playerid] == 1) {
if(IsPlayerInRangeOfPoint(playerid, 5.0,2542.60009766,-1587.80004883,22.00000000))
SendClientMessage(playerid, COLOR_GREEN, "You take 30 weeds!");
FakeWeed[playerid] = 0;
Weed[playerid] += 30;
GetPlayerFacingAngle(playerid, a);
GetPlayerPos(playerid, x, y, z);
DestroyObject(Seeds[playerid]);
} else {
SendClientMessage(playerid, COLOR_RED, "[ERROR:] You don't have enough weed for take");
}
return 1;
}
CMD:takeheroin(playerid, params[])
{
new Float:x, Float:y, Float:z, Float:a;
if (FakeHeroin[playerid] == 1) {
SendClientMessage(playerid, COLOR_GREEN, "You Take 15 heroins!");
FakeHeroin[playerid] = 0;
Heroin[playerid] += 15;
GetPlayerFacingAngle(playerid, a);
GetPlayerPos(playerid, x, y, z);
} else {
SendClientMessage(playerid, COLOR_RED, "[ERROR:] You don't have enough heroin for take");
}
return 1;
}
CMD:sellweed(playerid, params[])
{
if (Weed[playerid] >= 1) {
SendClientMessage(playerid, COLOR_GREEN, "You sell one weed !!");
Weed[playerid] -= 1;
GivePlayerMoney(playerid, 150);
} else {
SendClientMessage(playerid, COLOR_RED, "[ERROR:] You don't have any weed to sell!");
}
return 1;
}
CMD:sellheroin(playerid, params[])
{
if (Heroin[playerid] >= 1) {
SendClientMessage(playerid, COLOR_GREEN, "You sell one heroin!");
Heroin[playerid] -= 1;
GivePlayerMoney(playerid, 300);
} else {
SendClientMessage(playerid, COLOR_RED, "[ERROR:] You don't have any heroin to sell!");
}
return 1;
}
CMD:useweed(playerid, params[])
{
if (Weed[playerid] >= 5) {
SendClientMessage(playerid, COLOR_GREEN, "You use 5 grams weed + 8 health!");
Weed[playerid] -= 5;
SetPlayerWeather(playerid, -84);
SetPlayerDrunkLevel(playerid, 10000);
SetPlayerTime(playerid,4,00);
SetTimerEx("DrugsOff", 60000, false, "i", playerid);
new Float:Health;GetPlayerHealth(playerid,Health);
SetPlayerHealth(playerid,Health+8);
} else {
SendClientMessage(playerid, COLOR_RED, "[ERROR:] You don't have any weed to use!");
}
return 1;
}
CMD:useheroin(playerid, params[])
{
if (Heroin[playerid] >= 5 ) {
SendClientMessage(playerid, COLOR_GREEN, "You use 5 grams heroin + 8 armour!");
Heroin[playerid] -= 5;
SetPlayerWeather(playerid, -84);
SetPlayerDrunkLevel(playerid, 10000);
SetPlayerTime(playerid,4,00);
SetTimerEx("DrugsOff", 60000, false, "i", playerid);
new Float:Armour;GetPlayerArmour(playerid,Armour);
SetPlayerArmour(playerid,Armour+8);
} else {
SendClientMessage(playerid, COLOR_RED, "[ERROR:] You don't have any heroin to use!");
}
return 1;
}
public WeedGrow(playerid)
{
FakeWeed[playerid] = 1;
Seeds[playerid] = 0;
SendClientMessage(playerid, COLOR_GREEN, "Your Weed is ready!");
SendClientMessage(playerid, COLOR_GREEN, "Type /takeweed to take it!");
new Float:x, Float:y, Float:z, Float:a;
GetPlayerFacingAngle(playerid, a);
GetPlayerPos(playerid, x, y, z);
Seeds[playerid] = CreateObject(3409, x, y, z - 1.3, 0.0, 0.0, a + 90);
return 1;
}
public HeroinGrow(playerid)
{
DestroyObject(Seeds[playerid]);
FakeHeroin[playerid] = 1;
Seeds[playerid] = 0;
SendClientMessage(playerid, COLOR_GREEN, "Your Heroin is ready!");
SendClientMessage(playerid, COLOR_GREEN, "Type /takeheroin to take it");
return 1;
}
public TimerPlantou()
{
plantou = 0;
return 1;
}
forward Drugsoff(playerid);
public Drugsoff(playerid)
{
if(IsPlayerConnected(playerid))
{
SetCameraBehindPlayer(playerid);
SetPlayerDrunkLevel(playerid, 0);
SetPlayerWeather(playerid, 1);
SetPlayerTime(playerid,18,18);
}
return 0;
}
public OnPlayerConnect(playerid)
{
new formatZ[256];
format(formatZ,sizeof(formatZ),"Drugs_%s.ini",PlayerName(playerid));
if(!udb_Exists(formatZ))
{
udb_Create(formatZ,"209010");
}
Seeds[playerid] = dUserINT(formatZ).("Seeds");
Heroin[playerid] = dUserINT(formatZ).("Heroin");
Weed[playerid] = dUserINT(formatZ).("Weed");
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
new formatZ2[256];
format(formatZ2,sizeof(formatZ2),"Drugs_%s.ini",PlayerName(playerid));
dUserSetINT(formatZ2).("Seeds",Seeds[playerid]);
dUserSetINT(formatZ2).("Heroin",Heroin[playerid]);
dUserSetINT(formatZ2).("Weed",Weed[playerid]);
return 1;
}
stock PlayerName(playerid) {
new name[255];
GetPlayerName(playerid, name, 255);
return name;
}