20.07.2011, 00:10
Hey again guys,i was just wondering how to attack someone within a certain range and not needing to put there Ids to attack,for eg. '/rob (without id)' and the if the person isn't near it should state 'person not close enough'.Ive constructed a basic '/slap' script,it lacks those functions, here it is :
------------------------------------------------------------------------------
dcmd_fs(playerid, params[])
{
new ID;
if(sscanf(params, "i", ID)) SendClientMessage(playerid, COLOR_WHITE, "USAGE: /fs [id]");
else if(IsPlayerConnected(ID) == 0) SendClientMessage(playerid, COLOR_RED, "Player is not connected");
else
{
new Float:health;
new Float, Float:y, Float:z, name[60], string[100];
GetPlayerPos(ID, x, y, z);
SetPlayerPos(ID, x, y, z+1);
GetPlayerHealth(ID,health);
SetPlayerHealth(ID, health-5);
format(string, 100, "You have slapped %s[%d]", name, ID);
SendClientMessage(playerid, COLOR_YELLOW, string);
}
return 1;
}
--------------------------------------------------------------------------------
your help will be greatly appreciated
------------------------------------------------------------------------------
dcmd_fs(playerid, params[])
{
new ID;
if(sscanf(params, "i", ID)) SendClientMessage(playerid, COLOR_WHITE, "USAGE: /fs [id]");
else if(IsPlayerConnected(ID) == 0) SendClientMessage(playerid, COLOR_RED, "Player is not connected");
else
{
new Float:health;
new Float, Float:y, Float:z, name[60], string[100];
GetPlayerPos(ID, x, y, z);
SetPlayerPos(ID, x, y, z+1);
GetPlayerHealth(ID,health);
SetPlayerHealth(ID, health-5);
format(string, 100, "You have slapped %s[%d]", name, ID);
SendClientMessage(playerid, COLOR_YELLOW, string);
}
return 1;
}
--------------------------------------------------------------------------------
your help will be greatly appreciated