/rape help - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: /rape help (
/showthread.php?tid=385272)
/rape help -
T-Raw - 15.10.2012
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
AW: /rape help -
BiosMarcel - 15.10.2012
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(playerid, health);
if(health > 5 && IsPlayerConnected(playeird))
{
SetPlayerHealth(playeird, health-5);
}
else if(health <= 5 && IsPlayerConnected(playerid))
{
new string[256];
new victim[24];
SetPlayerHealth(playerid, health-5);
GetPlayerName(playerid,victim, 24);
format(string, sizeof(string), "%s(%d) Has died from Chlamydia",victim,playerid);
SendClientMessageToAll(0xB22222AA,string);
}
return 1;
}
public RapedPlayerRecent()
{
RapedRecently[playerid] =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;
RapeTimer[playerb][0] = SetTimer("RapedPlayerRecent",60000,false);
RapeTimer[playerb][1] = SetTimer("raped",1,false);
SendClientMessage(playerb, COLOR_YELLOW, "You Have Been Raped, Visit the hospital");
SendClientMessage(playerid, COLOR_YELLOW, "You Have Been Raped, Visit the hospital");
return 1;
}