Ugrás a fő tartalomhoz

NPC_GetVelocity

vigyázat

This function was added in omp v1.5.8.3079 and will not work in earlier versions!

Description

Gets the velocity of an NPC.

NameDescription
npcidThe ID of the NPC
&Float:xVariable to store the X velocity component, passed by reference
&Float:yVariable to store the Y velocity component, passed by reference
&Float:zVariable to store the Z velocity component, passed by reference

Returns

Returns true on success, false on failure.

Examples

public OnPlayerCommandText(playerid, cmdtext[])
{
if (!strcmp(cmdtext, "/checkvelocity", true))
{
new npcid = PlayerNPC[playerid];
if (npcid == INVALID_NPC_ID)
return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC.");

if (!NPC_IsValid(npcid))
return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC.");

new Float:velX, Float:velY, Float:velZ;
NPC_GetVelocity(npcid, velX, velY, velZ);

SendClientMessage(playerid, 0x00FF00FF, "NPC %d velocity: X=%.2f, Y=%.2f, Z=%.2f", npcid, velX, velY, velZ);
return 1;
}
return 0;
}

Notes

vigyázat
  • All velocity parameters are passed by reference and will be modified