SA-MP Forums Archive
Need help, making a /rape command - 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: Need help, making a /rape command (/showthread.php?tid=549270)



Need help, making a /rape command - MrViolence101 - 05.12.2014

I need help making a rape command. I cant figure out the distance situation. obviously you need to be close to someone to rape him.

Quote:

CMD:rape(playerid,params[])
{
new id;
new result[128];
new name[MAX_PLAYER_NAME], string[24+MAX_PLAYER_NAME], name2[MAX_PLAYER_NAME];

if (sscanf(params, "dz" ,id)) return SendClientMessage(playerid, COLOR_YELLOW, "Usage:\"/rape [ID]\"");
else if (!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_RED, "Invalid ID");
else if (!IsPlayerInRangeOfPoint(id)) return SendClientMessage(playerid, COLOR_RED, "The player is not near you");
else
{
GetPlayerName(playerid, name, sizeof(name));
GetPlayerName(id, name2, sizeof(name2));
format(result, sizeof(result),"{CC6600}%s {FFFFFF}has infected {CC6600}%s {FFFFFF}with {CC6600} Chlamydia",name,name2);
SendClientMessageToAll(COLOR_WHITE,result);
}
return 1;
}

Can anybody just help me to figure out the distance situation in this command. any help will be appreciated.


Re: Need help, making a /rape command - Beckett - 05.12.2014

pawn Код:
stock Float:GetDistanceBetweenPlayers(playerid,targetplayerid)
{
    new Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2;
    if(!IsPlayerConnected(playerid) || !IsPlayerConnected(targetplayerid)) {
        return -1.00;
    }
    GetPlayerPos(playerid,x1,y1,z1);
    GetPlayerPos(targetplayerid,x2,y2,z2);
    return floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2)+floatpower(floatabs(floatsub(y2,y1)),2)+floatpower(floatabs(floatsub(z2,z1)),2));
}
Use [pawn] code next time not [quote]


Re: Need help, making a /rape command - MrViolence101 - 05.12.2014

sorry im new to scripting, now i have that stock, how do i implement any of that into my command


Re: Need help, making a /rape command - Beckett - 05.12.2014

pawn Код:
if(GetDistanceBetweenPlayers(PlayerWhoDidTheCommand,TargetedPlayer) <= RangeBetweenPlayers)
{
//code if success
}
else
{
//code if fail
}



Re: Need help, making a /rape command - MrViolence101 - 05.12.2014

Where did you get the RangeBetweenPlayers from?


Re: Need help, making a /rape command - Beckett - 05.12.2014

pawn Код:
return floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2)+floatpower(floatabs(floatsub(y2,y1)),2)+floatpower(floatabs(floatsub(z2,z1)),2));
The returned value is the range between those two.


Re: Need help, making a /rape command - Pottus - 05.12.2014

Quote:
Originally Posted by MrViolence101
Посмотреть сообщение
I need help making a rape command. I cant figure out the distance situation. obviously you need to be close to someone to rape him.
A gay rapist lol?

Do this, #define RangeBetweenPlayers 1.0 // 1 meter


Re: Need help, making a /rape command - Beckett - 05.12.2014

Quote:
Originally Posted by Pottus
Посмотреть сообщение
A gay rapist lol?

Do this, #define RangeBetweenPlayers 1.0 // 1 meter
Why would he even need this? What are you on about?

Example usage:

pawn Код:
if(GetDistanceBetweenPlayers(playerid,target) <= 20)
{
print("u are in range of %i",target);
}
else
{
print("u are not in range of %i",target);
}



Re: Need help, making a /rape command - MrViolence101 - 05.12.2014

Quote:
Originally Posted by DaniceMcHarley
Посмотреть сообщение
Why would he even need this? What are you on about?

Example usage:

pawn Код:
if(GetDistanceBetweenPlayers(playerid,target) <= 20)
{
print("u are in range of %i",target);
}
else
{
print("u are not in range of %i",target);
}
I used 5 instead of 20.


Re: Need help, making a /rape command - Beckett - 05.12.2014

Quote:
Originally Posted by MrViolence101
Посмотреть сообщение
I used 5 instead of 20.
Use any distance you want lol it's up to you, good luck.