This site has been archived and made available for preservation purposes. No edits can be made.

Results 1 to 3 of 3

Thread: GetPlayerPos

  1. #1

    GetPlayerPos

    Code :
    native Float:GetPlayerPos(clientID, axis);
    /* GetPlayerPos
     * returns a Float referring to the position value on the specified axis (X_AXIS = X, Y_AXIS = Y, Z_AXIS = Z)
     * returns 0: invalid clientID / invalid axis parameter
     */

    If I did:
    Code :
    new Float: playerPos;
    GetPlayerPos(clientID, playerPos);

    Would that output:

    X: 0.0 Y: 0.0 Z: 0.0

    If I were at that location, usually the function should be like
    Code :
    native GetPlayerPos(clientID, Float:X, Float:Y, Float:Z);

    That way we can gather the X, Y, Z

    May not of made sense I couldn't explain this lol
    native GetPlayerPos(clientID, &x, &y, &z);
    A gaming community ran by one person, with servers made by individuals (in this case, me, myself)
    I plan to look for a trusted person who will help me create a decent roleplay/deathmatch server on Vault-TEC,
    PM me if you're interested

  2. #2
    Administrator
    Join Date
    Jun 2011
    Location
    Germany
    Posts
    1,057
    Blog Entries
    5

    Re: GetPlayerPos

    ATM you would have to use the function this way:

    Code :
    new Float:x, Float:y, Float:z;
    x = GetPlayerPos(clientID, X_AXIS);
    y = GetPlayerPos(clientID, Y_AXIS);
    z = GetPlayerPos(clientID, Z_AXIS);

    I know this sucks and I will change the syntax to that of the function you mentioned above. In fact I wasn't familiar how to write a native which takes references as arguments when I started implementing scripting functions

  3. #3

    Re: GetPlayerPos

    [quote author=Recycler link=topic=77.msg445#msg445 date=1311426424]
    ATM you would have to use the function this way:

    Code :
    new Float:x, Float:y, Float:z;
    x = GetPlayerPos(clientID, X_AXIS);
    y = GetPlayerPos(clientID, Y_AXIS);
    z = GetPlayerPos(clientID, Z_AXIS);

    I know this sucks and I will change the syntax to that of the function you mentioned above. In fact I wasn't familiar how to write a native which takes references as arguments when I started implementing scripting functions
    [/quote]

    You don't have to man, you can simply make a function:

    Code :
    stock GetPlayerPosFixed(playerid, &Float:X, &Float:Y, &Float:Z)
    {
    	X = GetPlayerPos(clientID, X_AXIS);
    	Y = GetPlayerPos(clientID, Y_AXIS);
    	Z = GetPlayerPos(clientID, Z_AXIS);
    }

    Thanks alot Recycler, never knew it

    This function should work, I'll place it in the useful functions thread
    A gaming community ran by one person, with servers made by individuals (in this case, me, myself)
    I plan to look for a trusted person who will help me create a decent roleplay/deathmatch server on Vault-TEC,
    PM me if you're interested

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •