Pissing on another player
#1

Hello guys.

I want to do a piss command so when i'm near a player and i type /piss, in the chatbox will say * player pissed on player.

Tnx )
Reply
#2

pawn Код:
Anycmd system(playerid, params[])
{
     // may want to #pragma unused params here if you dont want to have any parameters in the pee command.
     new Float: POS[3];
     GetPlayerPos(playerid, POS[0], POS[1], POS[2]);
     for(new i; i < MAX_PLAYERS+1; i++)
     {
          if(IsPlayerConnected(i) && IsPlayerInRange(i, 2, 2 , POS[0], POS[1], POS[2]))
          {
               new string[128];
               format(string, 128, "%s pissed on %s",GetPlayerNameshit(playerid),GetPlayerNameshit(i));
               break;
          }
     }
}
Reply
#3

BTW cameltoe where is the pissing animation, and what is break; ? can u make it with return 1;?
Reply
#4

break is to stop the for loop if you want to return 1; do that after the whole for loop.

Im not into anims so i dont know the anim, i guess if you search you can find an anim fs and look through them.
Reply
#5

Quote:
Originally Posted by Cameltoe
Посмотреть сообщение
break is to stop the for loop if you want to return 1; do that after the whole for loop.

Im not into anims so i dont know the anim, i guess if you search you can find an anim fs and look through them.

Here is the script and its giving me errors.

pawn Код:
dcmd_piss(playerid, params[])
{
     if(GetPlayerState == PLAYER_STATE_DRIVER) return SendClientMessage(playerid, COLOR_LRED, "You must leave your vehicle.");
     SetPlayerSpecialAction(playerid, SPECIAL_ACTION_PISSING);
     #pragma unused params
     new Float: POS[3];
     GetPlayerPos(playerid, POS[0], POS[1], POS[2]);
     for(new i; i < MAX_PLAYERS+1; i++)
     {
          if(IsPlayerConnected(i) && IsPlayerInRange(i, 2, 2 , POS[0], POS[1], POS[2]);
          {
               new string[128];
               format(string, 128, "* %s pisses on %s.",pNick(playerid),GetPlayerName(i));
               SendClientMessageToAll( COLOR_PINK, string );
          }
     }
     return 1;
}
pawn Код:
: error 076: syntax error in the expression, or invalid function call
: error 017: undefined symbol "IsPlayerInRange"
: error 001: expected token: ")", but found ";"
: error 036: empty statement
: fatal error 107: too many error messages on one line
Reply
#6

Quote:
Originally Posted by Cypress
Посмотреть сообщение
Here is the script and its giving me errors.

pawn Код:
dcmd_piss(playerid, params[])
{
     if(GetPlayerState == PLAYER_STATE_DRIVER) return SendClientMessage(playerid, COLOR_LRED, "You must leave your vehicle.");
     SetPlayerSpecialAction(playerid, SPECIAL_ACTION_PISSING);
     #pragma unused params
     new Float: POS[3];
     GetPlayerPos(playerid, POS[0], POS[1], POS[2]);
     for(new i; i < MAX_PLAYERS+1; i++)
     {
          if(IsPlayerConnected(i) && IsPlayerInRange(i, 2, 2 , POS[0], POS[1], POS[2]);
          {
               new string[128];
               format(string, 128, "* %s pisses on %s.",pNick(playerid),GetPlayerName(i));
               SendClientMessageToAll( COLOR_PINK, string );
          }
     }
     return 1;
}
pawn Код:
: error 076: syntax error in the expression, or invalid function call
: error 017: undefined symbol "IsPlayerInRange"
: error 001: expected token: ")", but found ";"
: error 036: empty statement
: fatal error 107: too many error messages on one line
IsPlayerInRangeOfPoint.
Reply
#7

As RetardedWolf already said it's IsPlayerInRangeOfPoint.

But you also need to make ; in the end of the if statement to ). (if statement gives error if ; is put)

And also you need to break; the loop or it will say you pissed on all people close to you.



As a last note, the string you have made is much longer than neccesary. It only needs 52 cells
Reply
#8

Theres an stock named IsPlayerInRange, let me find it

pawn Код:
stock IsPlayerInRange(playerid, Float:Range, Float:Z_Range, Float:tar_x, Float:tar_y, Float:tar_z) // checks if player is in range of a point
{
    new bool:care_z = true, Float:player_x, Float:player_y, Float:player_z, Float:radius_xy, Float:radius_z;
    GetPlayerPos(playerid, player_x, player_y, player_z);
    radius_xy = floatsqroot(floatadd(floatpower(floatsub(player_x,tar_x),2.0),floatpower(floatsub(player_y,tar_y),2.0)));
    radius_z = floatsqroot(floatadd(floatpower(radius_xy,2.0),floatpower(floatsub(player_z,tar_z),2.0)));
    if(radius_z > Z_Range && radius_xy < radius_z)
    {
        care_z = false;
    }
    if(radius_xy <= Range && care_z)
    {
        return 1;
    }
    return 0;
}
Reply
#9

This is what happens when people do not know how to script. They rely on other people to make everything for them, being lazy. The best thing to do is read the SA-MP Wiki and also visit some of the stickied threads around this forum. I know ******* has some basic scripting tutorials, so you should check that out as well.
Reply
#10

Why using IsPlayeInRange while IsPlayerInRangeOfPoint, there is like 7 characters difference.. plus its standard so less lagg.. And it might be slower
Reply
#11

Cause with IsPlayerInRange you can use Radius and z radius..
Reply
#12

Quote:
Originally Posted by Cameltoe
Посмотреть сообщение
Cause with IsPlayerInRange you can use Radius and z radius..
inrangeofpoint has range... but yea radius z..
Reply
#13

Quote:
Originally Posted by Mike_Peterson
Посмотреть сообщение
inrangeofpoint has range... but yea radius z..
Yeah would look really great if someone flew and typed /piss then someone on ground got pissed at. use IsPlayerInRange
Reply
#14

This looks like an old topic but my problem is not solved yet.

So when i type /piss it says 'You pisses on you', so as i see i'm pissing on my self. I need so if someone will type /piss and no one will be near it wont say nothing, it will only show me the animation.
Reply
#15

Quote:
Originally Posted by Cypress
Посмотреть сообщение
This looks like an old topic but my problem is not solved yet.

So when i type /piss it says 'You pisses on you', so as i see i'm pissing on my self. I need so if someone will type /piss and no one will be near it wont say nothing, it will only show me the animation.
Here's how to do a check if someone is near:

pawn Код:
new TempVar = INVALID_PLAYER_ID;
for(new i; i < MAX_PLAYERS; i++)
{
    if(IsPlayerInRange(i))
    {
          TempVar = i;
          break;
    }
}
if(TempVar == INVALID_PLAYER_ID){ return SendClientMessage(playerid, COLOR, "You pissed on %s");} // This text should be formated btw.
else
{
    // Player Found, Do the pissing.
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)