#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 
i = 0; i < MAX_PLAYERS; i++)
    {
        if(!
IsPlayerConnected(i)) continue;
        {
            if(
IsPlayerInRangeOfPoint(i, 5.0, x, y, z))
            {
                
SetPlayerPos(i, x, y, z+3);
                
SendClientMessage(i, 0xFF000FF, "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(playerid, params[])
{
    new 
Float:x,Float:y,Float:z;
    
GetPlayerPos(playerid,x,y,z);
    for(new 
i = 0; i < MAX_PLAYERS; i++)
    {
        if(!
IsPlayerConnected(i)) continue;
        {
            if(
IsPlayerInRangeOfPoint(i, 5.0, x, y, z))
            {
                
SetPlayerPos(i, x, y, z+3);
                
SendClientMessage(i, 0xFF000FF, "!Tested!");
          }
        return 
1;
      }
    return 
1;
    }
} 
Reply
#5

PHP код:
CMD:NSlap(playerid, params[])
{
    new 
Float:x,Float:y,Float:z;
    
GetPlayerPos(playerid,x,y,z);
    for(new 
i = 0; i < MAX_PLAYERS; i++)
    {
        if(!
IsPlayerConnected(i)) continue;
        {
            if(
IsPlayerInRangeOfPoint(i, 5.0, x, y, z))
            {
                
SetPlayerPos(i, x, y, z+3);
                
SendClientMessage(i, 0xFF000FF, "!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(playerid, params[]) 
{ 
    new 
Float:x,Float:y,Float:z;
    new 
id;
    
GetPlayerPos(playerid,x,y,z); 
    if(
sscanf(params, "u", id))
    { 
        if(!
IsPlayerConnected(id))
        { 
            if(
IsPlayerInRangeOfPoint(id, 5.0, x, y, z)) 
            { 
                
SetPlayerPos(id, x, y, z+3); 
            } 
       } 
    }
    return 
1; 
} 
Reply
#9

PHP код:
CMD:NSlap(playerid, params[]) 
{ 
    new 
Float:x,Float:y,Float:z; 
    
GetPlayerPos(playerid,x,y,z); 
    for(new 
i = 0; i < MAX_PLAYERS; i++) 
    { 
        if(!
IsPlayerConnected(i)) continue; 
        { 
            if(
IsPlayerInRangeOfPoint(i, 5.0, x, y, z) && i != playerid) 
            { 
                
SetPlayerPos(i, x, y, z+3); 
                
SendClientMessage(i, 0xFF000FF, "!Tested!"); 
            } 
       } 
    } 
    return 
1; 
} 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)