This timer to kill a player is not working.
#1

The player who gets infected must die slowly, but it's not working.
PHP код:
forward DropHP(playerid);
new 
countn1[MAX_PLAYERS];
new 
counttimer1[MAX_PLAYERS];
CMD:rape(playeridparams[])
{
    
/*if(Team[playerid] == COPS || Team[playerid] == ARMY || Team[playerid] == FBI || Team[playerid] == SWAT) return SendClientMessage(playerid, COLOR_PARAMS, "ERROR: Law Enforcements are not allowed to rape people.");*/
    
new raped;
    if(
sscanf(params,"u"raped))  return SendClientMessage(playeridCOLOR_PARAMS"USAGE: /rape [playerid]");
    if(
raped == INVALID_PLAYER_ID) return SendClientMessage(playeridCOLOR_PARAMS"ERROR: The player ID entered didn't exist.");
    
/*if(raped == playerid) return SendClientMessage(playerid, COLOR_PARAMS, "ERROR: You can't money/score farm, therefore, You can't rob yourself.");*/
    
new rand random(4), string[250];
    switch(
rand)
    {
        case 
0:
        {
            
format(stringsizeof(string), "%s has been infected with Chlamydia"PlayerName(raped));
            
SendClientMessageToAll(COLOR_GREYstring);
        }
        case 
1:
        {
            
format(stringsizeof(string), "%s has been infected with Syphilis"PlayerName(raped));
            
SendClientMessageToAll(COLOR_GREYstring);
        }
        case 
2:
        {
            
format(stringsizeof(string), "%s has been infected with Gonorrhea"PlayerName(raped));
            
SendClientMessageToAll(COLOR_GREYstring);
        }
        case 
3:
        {
            
format(stringsizeof(string), "%s has been infected with Hepatitis B"PlayerName(raped));
            
SendClientMessageToAll(COLOR_GREYstring);
        }
    }
    
counttimer1[raped]=SetTimerEx("DropHP",1000,true,"i"raped);
    
countn1[raped]=100;
    return 
1;
}
public 
DropHP(playerid)
{
    new 
Float:pHealth;
    
GetPlayerHealth(playerid,pHealth);
    
countn1[playerid]--;
    if(
countn1[playerid]!=0)
    {
       if(
pHealth!=0)
       {
           
pHealth--;
           
SetPlayerHealth(playerid,pHealth);
       }
       else {
KillTimer(counttimer1[playerid]);}
       }
    else {
KillTimer(counttimer1[playerid]);}
    return 
1;

Reply
#2

pawn Код:
forward DropHP(playerid);
new counttimer1[MAX_PLAYERS];

CMD:rape(playerid, params[])
{
    /*if(Team[playerid] == COPS || Team[playerid] == ARMY || Team[playerid] == FBI || Team[playerid] == SWAT) return SendClientMessage(playerid, COLOR_PARAMS, "ERROR: Law Enforcements are not allowed to rape people.");*/
    new raped;
    if(sscanf(params,"u", raped))  return SendClientMessage(playerid, COLOR_PARAMS, "USAGE: /rape [playerid]");
    if(raped == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_PARAMS, "ERROR: The player ID entered didn't exist.");
    /*if(raped == playerid) return SendClientMessage(playerid, COLOR_PARAMS, "ERROR: You can't money/score farm, therefore, You can't rob yourself.");*/
    new rand = random(4), string[250];
    switch(rand)
    {
        case 0:
        {
            format(string, sizeof(string), "%s has been infected with Chlamydia", PlayerName(raped));
            SendClientMessageToAll(COLOR_GREY, string);
        }
        case 1:
        {
            format(string, sizeof(string), "%s has been infected with Syphilis", PlayerName(raped));
            SendClientMessageToAll(COLOR_GREY, string);
        }
        case 2:
        {
            format(string, sizeof(string), "%s has been infected with Gonorrhea", PlayerName(raped));
            SendClientMessageToAll(COLOR_GREY, string);
        }
        case 3:
        {
            format(string, sizeof(string), "%s has been infected with Hepatitis B", PlayerName(raped));
            SendClientMessageToAll(COLOR_GREY, string);
        }
    }
    KillTimer(counttimer1[raped]);
    counttimer1[raped] = SetTimerEx("DropHP",1000,true,"i", raped);
    return 1;
}

public DropHP(playerid)
{
    new Float:pHealth;
    GetPlayerHealth(playerid,pHealth);
    if(pHealth != 0.0)
    {
        --pHealth;
        SetPlayerHealth(playerid,pHealth);
    }
    else KillTimer(counttimer1[playerid]);
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)