10.05.2012, 06:20
I guess use onplayerupdate, save their last position with SetPVarFloat
Then to use it:
That >0.01 may need tweeking
Код:
stock Float:Distance3D(Float:x1, Float:y1, Float:z1, Float:x2, Float:y2, Float:z2, bool:sqrt = false) { x1 -= x2; x1 *= x1; y1 -= y2; y1 *= y1; z1 -= z2; z1 *= z1; x1 += y1; x1 += z1; return sqrt ? floatsqroot(x1) : x1; } public OnPlayerUpdate(playerid) { new Float:Cx,Float:Cy,Float:Cz; GetPlayerPos(playerid,Cx,Cy,Cz); if (Distance3D(GetPVarFloat(playerid,"xpos"),GetPVarFloat(playerid,"ypos"),GetPVarFloat(playerid,"zpos"),Cx,Cy,Cz)>0.01) { SetPVarInt(playerid, "moving", 1); } else { SetPVarInt(playerid, "moving", 0); } SetPVarFloat(playerid,"xpos",Cx); SetPVarFloat(playerid,"ypos",Cy); SetPVarFloat(playerid,"zpos",Cz); return 1; }
Код:
if (GetPVarInt(playerid, "moving")==1) { //... Do somthing }