Timer / Command issue
#1

I've been sitting around trying to work on and really make a good drug system. I've only gotten around to crack so far, but it has all been going along nicely until now. My issue is that I have a system where if the player uses 6 grams of crack - they will overdose and need to get medical attention. I haven't fully implemented the EMS group, so the command I made to kill the timer and heal the player is healcrackoverdose. Well, the thing is that it's not working. I've tried timer ID 0, 1, and 2. It should be 0 as this was the first timer I've created in my entire script. Can someone tell me my issue?

Here is a good portion of all of the code I've made:

PHP код:
CMD:usecrack(playeridparams[])
{
    if(
UseDrugsTimer[playerid]) return SendClientMessage(playerid,COLOR_GREY,"You must wait 5 seconds!");
       if(
PlayerCrackStoned[playerid] >= 5)
    {
        
SendClientMessage(playeridCOLOR_RED"You have used too much crack; therefore you have overdosed!");
        
SendClientMessage(playeridCOLOR_RED"You must seek medical attention or you will die!");
        
SetTimerEx("Crackdeath"10000true"i"playerid);
    }
    if(
PlayerCrackStoned[playerid] >= 2)
    {
        
GameTextForPlayer(playerid"~w~You are~n~~p~Stoned"40001);
        
SetPlayerDrunkLevel(playerid15000);
        
SetPlayerWeather(playerid2009);
    }
    if(
PlayerDrugInfo[playerid][pCrack] >= 1)
    {
        new 
Float:armor;
        
GetPlayerArmour(playeridarmor);
        if(
armor 80) { SetPlayerArmour(playerid100.0); }
        else { 
SetPlayerArmour(playeridarmor 10.0); }
        
PlayerCrackStoned[playerid] += 1;
        
SendClientMessage(playeridCOLOR_BLUE"You have used a gram of crack!");
        
UseDrugsTimer[playerid] = 1PlayerDrugInfo[playerid][pCrack] -= 1;
        
SetTimerEx("UseDrugs",5*1000,0,"i",playerid);
        return 
1;
    }
    else
    {
        
SendClientMessage(playeridCOLOR_RED"You don't have any crack left!");
    }
    return 
1;
}
forward UseDrugs(playerid);
forward Crackdeath(playerid);
public 
UseDrugs(playerid)
{
    if(!
IsPlayerConnected(playerid)) return 0;
    if(
UseDrugsTimer[playerid])
    {
        
UseDrugsTimer[playerid] = 0;
    }
    return 
1;
}
public 
Crackdeath(playerid)
{
    new 
Float:hp;
    
GetPlayerHealth(playerid,hp);
    
SetPlayerHealth(playerid,hp-5);
}
CMD:healcrackoverdose(playeridparams[])
{
    
SetPlayerHealth(playerid100);
    
KillTimer();
    return 
1;

And then here is the rest:

PHP код:
new PlayerCrackStoned[MAX_PLAYERS];
new 
UseDrugsTimer[MAX_PLAYERS]; 
PHP код:
PlayerCrackStoned[playerid] = 0;
UseDrugsTimer[playerid] = 0
And then that right there I put under OnPlayerConnect.
Reply


Messages In This Thread
Timer / Command issue - by K9IsGodly - 31.03.2014, 01:55
Re: Timer / Command issue - by K9IsGodly - 31.03.2014, 11:28
Re: Timer / Command issue - by EiresJason - 31.03.2014, 11:37
Re: Timer / Command issue - by K9IsGodly - 31.03.2014, 11:48

Forum Jump:


Users browsing this thread: 2 Guest(s)