SA-MP Forums Archive
Embarrassing (CreateObject) - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Embarrassing (CreateObject) (/showthread.php?tid=227865)



Embarrassing (CreateObject) - Unknown123 - 18.02.2011

What need i do to get "MyObject" infron of me when i type the command to create the object?

Like if im facing South then i type the command, then the object spawn North (behind me)
and i want the object onfront of me... (My Facing Angle)

pawn Код:
new Float:X,Float:Y,Float:Z;
GetPlayerPos(playerid,X,Y,Z);
MyObject[playerid] = CreateObject(1337, X+0.8, Y, Z-1, 0.0, 0.0, 0.0);



Re: Embarrassing (CreateObject) - peterory - 18.02.2011

like the party server?


Re: Embarrassing (CreateObject) - Unknown123 - 18.02.2011

Quote:
Originally Posted by peterory
Посмотреть сообщение
like the party server?
No, maybe, i dont know.. i have never played on a party server, LoL


Re: Embarrassing (CreateObject) - jejemonerz123 - 18.02.2011

lol I dont know how to fix that XD


Re: Embarrassing (CreateObject) - Unknown123 - 18.02.2011

Nobudy can help? LuLz


Re: Embarrassing (CreateObject) - cmg4life - 18.02.2011

Use GetXYInFrontOfPlayer function, to get Object's X Y.


Re: Embarrassing (CreateObject) - Unknown123 - 18.02.2011

Quote:
Originally Posted by cmg4life
Посмотреть сообщение
Use GetXYInFrontOfPlayer function, to get Object's X Y.
It is night here and i havent slept much, and i fail

Could you give a example?

pawn Код:
#include <a_samp>

new MyObject[MAX_PLAYERS];

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/create", cmdtext, true, 10) == 0)
    {
        new Float:X, Float:Y, Float:Z;
        GetPlayerPos(playerid, X, Y, Z);
       
        MyObject[playerid] = CreateObject(1337, X+0.8, Y, Z-1, 0.0, 0.0, 0.0);
        return 1;
    }
    return 0;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    DestroyObject(MyObject[playerid]);
    return 1;
}