02.05.2015, 18:16
Quote:
First of all, you need a stock, like so:
Код:
stock GetDistanceBetweenPlayers(playerid, playerid2) { new Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2; new Float:dis; GetPlayerPos(playerid,x1,y1,z1); GetPlayerPos(playerid2,x2,y2,z2); dis = floatsqroot((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)+(z2-z1)*(z2-z1)); return floatround(dis); } Create the command, which would be " Код:
CMD:pay(playerid, params[]) Afterwards, we have to create a 1 time variable, which would hold the ID of the player who is being paid. Example: new id; Once you have done everything including both IDs and the initial command itself, measure the distance between both players, via the following: if(GetDistanceBetweenPlayers(playerid, id) < 7) - You can choose whichever range you need. That is pretty much all there is too it. |
And it's not a stock, it's a function.