#1

So i have problem with my drugs, if player take drugs and rejoin he still on drugs.... also i want to add like if he have taken drugs, and try to take more, it will send a message like "please finish your current drugs before taking more", and when it is finished he can take more, how i can do this


This what i have in my drugs command

pawn Код:
DrugTimer[playerid] = SetTimerEx("DrugsE", 1300, 3, "ii", playerid, amount);

public DrugsE(playerid,amount)
{
    new Float:hZ;
    busyAnim[playerid] = false;
    GetPlayerHealth(playerid, hZ);
    Deffect[playerid]++;
    SetPlayerHealth(playerid, hZ+2);
    if(hZ > 100.0) SetPlayerHealth(playerid, 100.0);
    if(Deffect[playerid] >= amount) return KillTimer(DrugTimer[playerid]);
    return 1;
}


public Busy(playerid, bool:type)
{
    if(type == true) { busyAnim[playerid] = true; }
    else if(type == false) { busyAnim[playerid] = false; }
    return 1;
}
Reply
#2

Show the command with the drugs.
Reply
#3

pawn Код:
CMD:drugs(playerid, params[])
{
    new str[128], amount;
    Drugs[playerid] -= amount;
    Deffect[playerid] = 0;
    DrugTimer[playerid] = SetTimerEx("DrugsE", 1300, 3, "ii", playerid, amount);
    SetTimerEx("Busy", 5000,0, "ii", playerid, false);
    ApplyAnimation(playerid, "SMOKING","M_smk_in", 4.2, 0, 0, 0, 0, 0, 1);
    busyAnim[playerid] = true;
//  GameTextForPlayer(playerid,"~w~Press ~b~~k~~VEHICLE_ENTER_EXIT~ ~w~to stop animation",3000,3);
    GameTextForPlayer(playerid, "~w~on drugs", 3000, 3);
    format(str, 128, "took %d Of Drugs. your health will refill.", amount);
    SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
    return 1;
}
Reply
#4

i dont think that command will work
where is the sscanf line
Reply
#5

pawn Код:
if(sscanf(params, "d", amount)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /takedrugs (Amount) ");
Reply
#6

I think you have to stop the timer if a player leaves the server.

So place this in "OnPlayerDisconnect"
Код:
KillTimer(DrugTimer[playerid]);
Reply
#7

How i can do the other? Like when he try to take more drugs he cant
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)