17.07.2012, 14:39
pawn Код:
CMD:usedrug(playerid, params[])
{
if(LoggedIn[playerid] == 0)return SendClientMessage(playerid, COLOUR_GREY, "You must be logged in to use this command.");
PlayerSQLID[playerid] = MySQL_GetValue(PlayerSQLID[playerid], "id", "accounts");
Cocaine[playerid] = MySQL_GetValue(PlayerSQLID[playerid], "Cocaine", "accounts");
Weed[playerid] = MySQL_GetValue(PlayerSQLID[playerid], "Weed", "accounts");
if(Cocaine[playerid] && Weed[playerid] == 0)return SendClientMessage(playerid, COLOUR_GREY, "You do not have any drugs to use.");
new usage[24], string[128];
if(sscanf(params, "s[24]", usage)) return SendClientMessage(playerid, COLOUR_GREY, "USAGE: /usedrug [drug] - Drug types: weed, coke.");
if(!strcmp(usage, "coke", true))
{
if(IsDrugged[playerid] == 1) return SendClientMessage(playerid, COLOUR_GREY, "You are already using drugs.");
if(Cocaine[playerid] == 0) return SendClientMessage(playerid, COLOUR_GREY, "You do not have any cocaine.");
SetPlayerWeather(playerid, 39);
SetPlayerDrunkLevel(playerid, 3000);
Cocaine[playerid] = Cocaine[playerid] - 1;
DrugUsed[playerid] = 1;
IsDrugged[playerid] = 1;
DruggedTime[playerid] = 45;
PlayerSQLID[playerid] = MySQL_GetValue(PlayerSQLID[playerid], "id", "accounts");
MySQL_SetInteger(PlayerSQLID[playerid], "Cocaine", Cocaine[playerid], "accounts");
SetTimer("DruggedTimer", 1000, 1);
format(string, sizeof(string), "You have taken 1 gram of cocaine, you will recieve an armour boost after the effects wear off.");
SendClientMessage(playerid, COLOUR_WHITE, string);
}
if(!strcmp(usage, "weed", true))
{
if(IsDrugged[playerid] == 1) return SendClientMessage(playerid, COLOUR_GREY, "You are already using drugs.");
if(Weed[playerid] == 0) return SendClientMessage(playerid, COLOUR_GREY, "You do not have any weed.");
SetPlayerWeather(playerid, 20);
SetPlayerDrunkLevel(playerid, 3000);
Weed[playerid] = Weed[playerid] - 1;
IsDrugged[playerid] = 1;
DrugUsed[playerid] = 2;
DruggedTime[playerid] = 45;
PlayerSQLID[playerid] = MySQL_GetValue(PlayerSQLID[playerid], "id", "accounts");
MySQL_SetInteger(PlayerSQLID[playerid], "Weed", Weed[playerid], "accounts");
SetTimer("DruggedTimer", 1000, 1);
format(string, sizeof(string), "You have taken 1 gram of weed, you will recieve a health boost after the effects wear off.");
SendClientMessage(playerid, COLOUR_WHITE, string);
}
return 1;
}