Ranged command
#1

Anybody know how to make a command that sets a skin for everyone who are in range.

Something like this

/rangeskin <range> <skinid>
Reply
#2

Not tested:

pawn Код:
CMD:rangeskin(playerid, params[])
{
    new Float:posx, Float:posy, Float:posz;
    new Float:range, skinid;
    if(sscanf(params, "fd", range, skinid)) return SendClientMessage(playerid, 0xFFFFFFFF, "Correct usage: /rangeskin [range] [skinid]");
    GetPlayerPos(playerid, posx, posy, posz);
    for(new i = 0; i < MAX_PLAYERS; i ++)
    {
        if(IsPlayerConnected(i))
        {
            if(IsPlayerInRangeOfPoint(i, range, posx, posy, posz);
            {
                SetPlayerSkin(i, skinid);
            }
        }
    }
    return 1;
}
Use ZCMD and sscanf.
Reply
#3

pawn Код:
CMD:rangeskin( playerid, params[ ] )
{
    new
        Float: range,
        skinid
    ;
    if( sscanf( params, "fd", range, skinid ) ) return SendClientMessage( playerid, -1, "Syntax: /rangeskin <range> <skinid>" );
    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, range, x, y, z ) ) SetPlayerSkin( i, skinid );
    }
    return 1;
}
EDIT: Too late!
Reply
#4

pawn Код:
#define COLOR_GRAD3         0xCBCCCEFF

CMD:rangeskin(playerid,params[])
{
   new skinid, Float:range;
   if(sscanf(params,"fi",range,skinid)) return SCM(playerid,COLOR_GRAD3,"USAGE: /rangeskin [skin id]");
   new Float:x,Float:y,Float:z;  
   GetPlayerPos(playerid,x,y,z);
   
    for(new i=0; i<MAX_PLAYERS;i++)
    {
         if(IsPlayerConnected(i))
         {
         if(IsPlayerInRangeOfPoint(i,range,x,y,z))
         {
             SetPlayerSkin(i,skinid);
         }
         }
    }
    return 1;
}
EDIT: Too late too lol.
Reply
#5

What about ranged weapons? I tried doing one but it just takes away the player's weapons instead of giving them
Reply
#6

pawn Код:
CMD:rangeweapon( playerid, params[ ] )
{
    new
        Float: range,
        weaponid,
        ammo
    ;
    if( sscanf( params, "fdd", range, weaponid, ammo ) ) return SendClientMessage( playerid, -1, "Syntax: /rangeweapon <range> <weaponid> <ammo>" );
    switch( weaponid )
    {
        case 0 .. 18, 22 .. 46:
        {
            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, range, x, y, z ) ) GivePlayerWeapon( i, weaponid, ammo );
            }
        }
        default: SendClientMessage( playerid, -1, "Invalid weaponid" );
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)