Need help, making a /rape command
#1

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.
Reply
#2

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]
Reply
#3

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

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

Where did you get the RangeBetweenPlayers from?
Reply
#6

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.
Reply
#7

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
Reply
#8

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);
}
Reply
#9

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.
Reply
#10

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


Forum Jump:


Users browsing this thread: 1 Guest(s)