#1

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

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

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

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

Reply
#5

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;

Reply
#6

Unknown Command.
Reply
#7

It slaps me instead of others, Anything wrong?
Reply
#8

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

Reply
#9

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

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)