/rape help
#1

Code:
//above
forward raped();
forward RapedPlayerRecent();

new Raped[MAX_PLAYERS];
new RapedRecently[MAX_PLAYERS];

//under gamemodeint
SetTimer("RapedPlayerRecent",60000, true);
SetTimer("raped",10000,1);

//connect + death
Raped[playerid] = 0;
RapedRecently[playerid] = 0;
//the remainder
public raped()
{
    for(new i = 0; i < MAX_PLAYERS; i++)
	{
      new Float:health;
      GetPlayerHealth(i, health);

      if(Raped[i] == 1 && health > 5 && Raped[i] == 1 && IsPlayerConnected(i))
	  {
	   SetPlayerHealth(i, health-5);
       }
       else
	   if(Raped[i] == 1 && health <= 5 && Raped[i] == 1 && IsPlayerConnected(i))
	   {
	   new string[256];
	   new victim[24];
	   SetPlayerHealth(i, health-5);
       GetPlayerName(i,victim, 24);
       format(string, sizeof(string), "%s(%d) Has died from Chlamydia",victim,i);
	   SendClientMessageToAll(0xB22222AA,string);
       }
     }
   }

public RapedPlayerRecent()
{
    for(new i = 0; i < MAX_PLAYERS; i++)
	{
      if(RapedRecently[i] == 1)
	  {
        RapedRecently[i] =0;
    }
  }
}

CMD:rape(playerid, params[])
{
	new playerb;
	if(sscanf(params, "u", playerb)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /rape [id]");
	if(Job[playerid] != 1) return SendClientMessage(playerid, COLOR_WHITE,"Your Not a Rapist");
	if(RapedRecently[playerb] == 1) return SendClientMessage(playerid, COLOR_WHITE,"He Was Recently Raped");
	RapedRecently[playerb] = 1;
	Raped[playerb] = 1;
	SendClientMessage(playerb, COLOR_YELLOW, "You Have Been Raped, Visit the hospital");
	SendClientMessage(playerid, COLOR_YELLOW, "You Have Been Raped, Visit the hospital");
	return 1;
}
he got rated but the health does not decrease anybody can fix this pleasehelp
Reply
#2

PHP Code:
//above
new RapeTimer[MAX_PLAYERS][2];
forward raped();
forward RapedPlayerRecent();
new 
Raped[MAX_PLAYERS];
new 
RapedRecently[MAX_PLAYERS];
//under gamemodeint
SetTimer("raped",10000,1);
//connect + death
Raped[playerid] = 0;
RapedRecently[playerid] = 0;
//the remainder
public raped()
{
     new 
Float:health;
     
GetPlayerHealth(playeridhealth);
     if(
health && IsPlayerConnected(playeird))
     {
     
SetPlayerHealth(playeirdhealth-5);
     }
     else if(
health <= && IsPlayerConnected(playerid))
     {
     new 
string[256];
     new 
victim[24];
     
SetPlayerHealth(playeridhealth-5);
     
GetPlayerName(playerid,victim24);
     
format(stringsizeof(string), "%s(%d) Has died from Chlamydia",victim,playerid);
     
SendClientMessageToAll(0xB22222AA,string);
     }
     return 
1;
}
public 
RapedPlayerRecent()
{
    
RapedRecently[playerid] =0;
}
CMD:rape(playeridparams[])
{
    new 
playerb;
    if(
sscanf(params"u"playerb)) return SendClientMessage(playeridCOLOR_WHITE"USAGE: /rape [id]");
    if(
Job[playerid] != 1) return SendClientMessage(playeridCOLOR_WHITE,"Your Not a Rapist");
    if(
RapedRecently[playerb] == 1) return SendClientMessage(playeridCOLOR_WHITE,"He Was Recently Raped");
    
RapedRecently[playerb] = 1;
    
RapeTimer[playerb][0] = SetTimer("RapedPlayerRecent",60000,false);
    
RapeTimer[playerb][1] = SetTimer("raped",1,false);
    
SendClientMessage(playerbCOLOR_YELLOW"You Have Been Raped, Visit the hospital");
    
SendClientMessage(playeridCOLOR_YELLOW"You Have Been Raped, Visit the hospital");
    return 
1;

Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)