26.08.2012, 06:46
Hi,
i want to find out whether a player is near a specific object.
I searched and found this code:
This is the code under OnPlayerUpdate:
But there are some problems:
(17535) : error 029: invalid expression, assumed zero
(17535) : warning 215: expression has no effect
(17535) : error 001: expected token: ";", but found ")"
(17535) : error 029: invalid expression, assumed zero
(17535) : fatal error 107: too many error messages on one line
17353 is this line: stock IsPlayerNearObject(Float:radi, playerid, objectid) IsPlayerNear(radi, playerid, objectid, GetObjectPos)
Hope you can help me
i want to find out whether a player is near a specific object.
I searched and found this code:
Код:
#define IsPlayerNear(%1,%2,%3,%4) \ { \ new Float:Pos[6], i; \ GetPlayerPos(%2, Pos[0], Pos[1], Pos[2]); \ %4(%3, Pos[3], Pos[4], Pos[5]); \ for(i = 0; i < 3; i++) Pos[i] = floatsub(Pos[i + 3], Pos[i]); \ if (%1 > Pos[0] > -%1) && \ (%1 > Pos[1] > -%1) && \ (%1 > Pos[2] > -%1) ) return 1; \ return 0; \ } stock IsPlayerNearPlayer(Float:radi, playerid, otherplayerid) IsPlayerNear(radi, playerid, otherplayerid, GetPlayerPos) stock IsPlayerNearObject(Float:radi, playerid, objectid) IsPlayerNear(radi, playerid, objectid, GetObjectPos) stock IsPlayerNearVehicle(Float:radi, playerid, vehicleid) IsPlayerNear(radi, playerid, vehicleid, GetVehiclePos)
Код:
if(IsPlayerNearObject(5,playerid,carramp)) { SendClientMessage(playerid,0xC30000FF,"Test"); }
(17535) : error 029: invalid expression, assumed zero
(17535) : warning 215: expression has no effect
(17535) : error 001: expected token: ";", but found ")"
(17535) : error 029: invalid expression, assumed zero
(17535) : fatal error 107: too many error messages on one line
17353 is this line: stock IsPlayerNearObject(Float:radi, playerid, objectid) IsPlayerNear(radi, playerid, objectid, GetObjectPos)
Hope you can help me