
dcmd_rape(playerid, params[])
{
new ID = strval(params);
if(!strlen(params))
{
SendClientMessage(playerid, COLOR_ERROR, "USAGE: /rape [ID]");
}
else
{
if(!IsPlayerConnected(ID)) return SendClientMessage(playerid, COLOR_ERROR, "That player is not connected!");
if(ID == playerid) return SendClientMessage(playerid, COLOR_ERROR, "You cannot rape yourself!");
if(rapespam[playerid] == 0)
{
if(GetDistanceBetweenPlayers(playerid,ID) > RAPE_DISTANCE) return SendClientMessage(playerid, COLOR_ERROR, "You are not close enough to eachother!");
new raperand = random(5);
if(raperand == 1 || raperand == 2)
{
format(string, sizeof(string), "%s (%i) noticed you trying to rape him", ReturnPlayerName(ID), ID);
SendClientMessage(playerid, COLOR_MSG, string);
format(string, sizeof(string), "%s (%i) tried to rape you", ReturnPlayerName(playerid), playerid);
SendClientMessage(ID, COLOR_MSG, string);
}
else if(raperand == 3 || raperand == 5)
{
if(!chlamydia[ID])
{
chlamydia[ID] = 1;
new Float:health;
GetPlayerHealth(ID, health);
SetPlayerHealth(ID, health-5-random(10));
format(string, 256, "You raped and infected %s (%i) with Chlamydia", ReturnPlayerName(ID), ID);
SendClientMessage(playerid, COLOR_MSG, string);
format(string, sizeof(string), "%s (%i) raped you and infected you with Chlamydia", ReturnPlayerName(playerid), playerid);
SendClientMessage(ID, COLOR_MSG, string);
}
else
{
new Float:health;
GetPlayerHealth(ID, health);
SetPlayerHealth(ID, health-5-random(15));
format(string, 256, "You raped %s (%i)", ReturnPlayerName(ID), ID);
SendClientMessage(playerid, COLOR_MSG, string);
format(string, sizeof(string), "%s (%i) raped you", ReturnPlayerName(playerid), playerid);
SendClientMessage(ID, COLOR_MSG, string);
}
}
else if(raperand == 4)
{
if(!gonorrhea[ID])
{
gonorrhea[ID] = 1;
new Float:health;
GetPlayerHealth(ID, health);
SetPlayerHealth(ID, health-5-random(20));
format(string, 256, "You raped and infected %s (%i) with Gonorrhea", ReturnPlayerName(ID), ID);
SendClientMessage(playerid, COLOR_MSG, string);
format(string, sizeof(string), "%s (%i) raped you and infected you with Gonorrhea", ReturnPlayerName(playerid), playerid);
SendClientMessage(ID, COLOR_MSG, string);
}
else
{
new Float:health;
GetPlayerHealth(ID, health);
SetPlayerHealth(ID, health-5-random(20));
format(string, 256, "You raped %s (%i)", ReturnPlayerName(ID), ID);
SendClientMessage(playerid, COLOR_MSG, string);
format(string, sizeof(string), "%s (%i) raped you", ReturnPlayerName(playerid), playerid);
SendClientMessage(ID, COLOR_MSG, string);
}
}
rapespam[playerid] = 1;
SetTimerEx("rapespamt", ANTISPAM_RAPE*1000, false, "i", playerid);
}
else
{
SendClientMessage(playerid, COLOR_ERROR, "Please wait before raping someone again!");
}
}
return 1;
}
stock Float:GetPlayerDistanceFromPlayer(playerid, targetid)
{
new Float:fDist[3];
GetPlayerPos(playerid, fDist[0], fDist[1], fDist[2]);
return GetPlayerDistanceFromPoint(targetid, fDist[0], fDist[1], fDist[2]);
}
|
give this a try
pawn Код:
|
|
You had a strong start, but for some reason you failed to actually do anything when the player was near someone. Do you the spot where you checked if the player was near anyone? Within those braces is where you need to place all of the action that occurs.
|
stock Float:GetPlayerDistanceFromPlayer(playerid, targetid)
{
new Float:fDist[3];
GetPlayerPos(playerid, fDist[0], fDist[1], fDist[2]);
return GetPlayerDistanceFromPoint(targetid, fDist[0], fDist[1], fDist[2]);
}
CMD:rape(playerid, params[])
{
if(GetTickCount() - rapespam[playerid] < ANTISPAM_RAPE*1000) SendClientMessage(playerid, COLOR_ERROR, "Please wait before raping someone again!");
else
{
new ID;
sscanf(params,"u",ID);
if(ID != INVALID_PLAYER_ID)
{
if(ID == playerid) SendClientMessage(playerid, COLOR_ERROR, "You cannot rape yourself!");
else
{
if(GetPlayerDistanceFromPlayer(playerid, ID) > 5.0) SendClientMessage(playerid, COLOR_ERROR, "You are not close enough to that player!");
else
{
new raperand = random(5);
if(raperand == 1 || raperand == 2)
{
format(string, sizeof(string), "%s (%i) noticed you trying to rape him", ReturnPlayerName(ID), ID);
SendClientMessage(playerid, COLOR_MSG, string);
format(string, sizeof(string), "%s (%i) tried to rape you", ReturnPlayerName(playerid), playerid);
SendClientMessage(ID, COLOR_MSG, string);
}
else
{
new Float:health;
GetPlayerHealth(ID, health);
if(raperand == 3 || raperand == 5)
{
if(!chlamydia[ID])
{
chlamydia[ID] = 1;
SetPlayerHealth(ID, health-5-random(10));
format(string, 256, "You raped and infected %s (%i) with Chlamydia", ReturnPlayerName(ID), ID);
SendClientMessage(playerid, COLOR_MSG, string);
format(string, sizeof(string), "%s (%i) raped you and infected you with Chlamydia", ReturnPlayerName(playerid), playerid);
}
else
{
SetPlayerHealth(ID, health-5-random(15));
format(string, 256, "You raped %s (%i)", ReturnPlayerName(ID), ID);
SendClientMessage(playerid, COLOR_MSG, string);
format(string, sizeof(string), "%s (%i) raped you", ReturnPlayerName(playerid), playerid);
}
}
else if(raperand == 4)
{
if(!gonorrhea[ID])
{
gonorrhea[ID] = 1;
SetPlayerHealth(ID, health-5-random(20));
format(string, 256, "You raped and infected %s (%i) with Gonorrhea", ReturnPlayerName(ID), ID);
SendClientMessage(playerid, COLOR_MSG, string);
format(string, sizeof(string), "%s (%i) raped you and infected you with Gonorrhea", ReturnPlayerName(playerid), playerid);
}
else
{
SetPlayerHealth(ID, health-5-random(20));
format(string, 256, "You raped %s (%i)", ReturnPlayerName(ID), ID);
SendClientMessage(playerid, COLOR_MSG, string);
format(string, sizeof(string), "%s (%i) raped you", ReturnPlayerName(playerid), playerid);
}
}
SendClientMessage(ID, COLOR_MSG, string);
rapespam[playerid] = GetTickCount();
}
}
}
}
}
return 1;
}