SA-MP Forums Archive
Pissing on another player - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Pissing on another player (/showthread.php?tid=178571)



Pissing on another player - Cypress - 22.09.2010

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 )


Re: Pissing on another player - Cameltoe - 22.09.2010

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;
          }
     }
}



Re: Pissing on another player - Cypress - 22.09.2010

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


Re: Pissing on another player - Cameltoe - 22.09.2010

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.


Re: Pissing on another player - Cypress - 23.09.2010

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



Re: Pissing on another player - Retardedwolf - 23.09.2010

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.


Re: Pissing on another player - Desert - 23.09.2010

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


Re: Pissing on another player - Cameltoe - 23.09.2010

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;
}



Re: Pissing on another player - Scenario - 23.09.2010

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.


Re: Pissing on another player - Claude - 23.09.2010

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


Re: Pissing on another player - Cameltoe - 23.09.2010

Cause with IsPlayerInRange you can use Radius and z radius..


Re: Pissing on another player - Mike_Peterson - 23.09.2010

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


Re: Pissing on another player - Cameltoe - 23.09.2010

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


Re: Pissing on another player - Cypress - 04.11.2010

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.


Re: Pissing on another player - Cameltoe - 05.11.2010

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.
}