24.09.2013, 15:51
Anybody know how to make a command that sets a skin for everyone who are in range.
Something like this
/rangeskin <range> <skinid>
Something like this
/rangeskin <range> <skinid>
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;
}
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;
}
#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;
}
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;
}