SA-MP Forums Archive
Slap - 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: Slap (/showthread.php?tid=605763)



Slap - SaiyanZ - 24.04.2016

Hello,
Is there any way that i make a command, And the players near me get pushed back or just simply get slapped?



Re: Slap - J0sh... - 24.04.2016

Do a loop.
Get your own position.
Check if people in the loop is within the distance.
Slap them.


Re: Slap - oMa37 - 24.04.2016

Not sure if it works, i just made it :P:

PHP код:
new Float:x,Float:y,Float:z;
GetPlayerPos(playerid,x,y,z);
    for(new 
0MAX_PLAYERSi++)
    {
        if(!
IsPlayerConnected(i)) continue;
        {
            if(
IsPlayerInRangeOfPoint(i5.0xyz))
            {
                
SetPlayerPos(ixyz+3);
                
SendClientMessage(i0xFF000FF"blablabla");
            }
            return 
1;
        }
        return 
1;
    } 



Re: Slap - SaiyanZ - 24.04.2016

Is this right?
No error but it says CMD_NSlap should return a value, If i try then it says unknown command, Maybe something wrong in it?
PHP код:
CMD:NSlap(playeridparams[])
{
    new 
Float:x,Float:y,Float:z;
    
GetPlayerPos(playerid,x,y,z);
    for(new 
0MAX_PLAYERSi++)
    {
        if(!
IsPlayerConnected(i)) continue;
        {
            if(
IsPlayerInRangeOfPoint(i5.0xyz))
            {
                
SetPlayerPos(ixyz+3);
                
SendClientMessage(i0xFF000FF"!Tested!");
          }
        return 
1;
      }
    return 
1;
    }




Re: Slap - J0sh... - 24.04.2016

PHP код:
CMD:NSlap(playeridparams[])
{
    new 
Float:x,Float:y,Float:z;
    
GetPlayerPos(playerid,x,y,z);
    for(new 
0MAX_PLAYERSi++)
    {
        if(!
IsPlayerConnected(i)) continue;
        {
            if(
IsPlayerInRangeOfPoint(i5.0xyz))
            {
                
SetPlayerPos(ixyz+3);
                
SendClientMessage(i0xFF000FF"!Tested!");
            }
       }
    }
    return 
1;




Re: Slap - SaiyanZ - 24.04.2016

Unknown Command.


Re: Slap - SaiyanZ - 25.04.2016

It slaps me instead of others, Anything wrong?


Re: Slap - oMa37 - 25.04.2016

Try this out:
PHP код:
CMD:slap(playeridparams[]) 

    new 
Float:x,Float:y,Float:z;
    new 
id;
    
GetPlayerPos(playerid,x,y,z); 
    if(
sscanf(params"u"id))
    { 
        if(!
IsPlayerConnected(id))
        { 
            if(
IsPlayerInRangeOfPoint(id5.0xyz)) 
            { 
                
SetPlayerPos(idxyz+3); 
            } 
       } 
    }
    return 
1




Re: Slap - nezo2001 - 25.04.2016

PHP код:
CMD:NSlap(playeridparams[]) 

    new 
Float:x,Float:y,Float:z
    
GetPlayerPos(playerid,x,y,z); 
    for(new 
0MAX_PLAYERSi++) 
    { 
        if(!
IsPlayerConnected(i)) continue; 
        { 
            if(
IsPlayerInRangeOfPoint(i5.0xyz) && != playerid
            { 
                
SetPlayerPos(ixyz+3); 
                
SendClientMessage(i0xFF000FF"!Tested!"); 
            } 
       } 
    } 
    return 
1