SA-MP Forums Archive
Creating a object at players pos? - 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)
+--- Thread: Creating a object at players pos? (/showthread.php?tid=403582)



Creating a object at players pos? - davve95 - 30.12.2012

Hi!


How can I create a object at a players pos ?

I've tired but I don't know exactly..


pawn Код:
CreatePickup(1212, 4, x, y, z, GetPlayerVirtualWorld(playerid));
Like that ^ but with a object instead...


Re: Creating a object at players pos? - PDChaseOfficial - 30.12.2012

Код:
new Float:x,Float:y,Float:z;
GetPlayerPos(playerid,x,y,z);
CreateObject(1212,x,y,z);



Re: Creating a object at players pos? - davve95 - 30.12.2012

Quote:
Originally Posted by PDChaseOfficial
Посмотреть сообщение
Код:
new Float:x,Float:y,Float:z;
GetPlayerPos(playerid,x,y,z);
CreateObject(1212,x,y,z);
Thanks alot! I just forgot the first thing (That above).


Edit when I tired out this before with out help

I got this error:

Код:
C:\Users\Davve\Desktop\Bomb Scirpt.pwn(26) : error 017: undefined symbol "X"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
And I get it now also.

Thanks for help!.


Re: Creating a object at players pos? - Hoss - 31.12.2012

pawn Код:
new Float:X,Float:Y,Float:Z;



Re: Creating a object at players pos? - davve95 - 31.12.2012

Thanks alot for help!..

But still problem:

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/plant", cmdtext, true, 10) == 0)
    {
        GetPlayerPos(playerid, x, y, z);
        CreateObject(1636, X, Y, Z);
        return 1;
    }
    return 0;
}



Re: Creating a object at players pos? - Konstantinos - 31.12.2012

pawn Код:
// Syntax:
CreateObject(modelid, Float:X, Float:Y, Float:Z, Float:rX, Float:rY, Float:rZ, Float:DrawDistance);
And "/plant"'s lenght is 6, not 10.


Re: Creating a object at players pos? - davve95 - 31.12.2012

That with lenght I didn't know!..

Why is that needed ??.. Anyway here's the error forgot to post them:

Код:
C:\Users\Davve\Desktop\Bomb Scirpt.pwn(26) : warning 202: number of arguments does not match definition
C:\Users\Davve\Desktop\Bomb Scirpt.pwn(26) : warning 202: number of arguments does not match definition
C:\Users\Davve\Desktop\Bomb Scirpt.pwn(26) : warning 202: number of arguments does not match definition
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Warnings.



Re: Creating a object at players pos? - Konstantinos - 31.12.2012

It needs atleast 7 parameters(DrawDistance is optional), and you've got 4. You're missing 3 parameters.
pawn Код:
Float:rX, Float:rY, Float:rZ



Re: Creating a object at players pos? - davve95 - 31.12.2012

Oh I see !, thanks alot!.

Edit: I thought it was lenght of the / how many letter in the / Before LOL!....

But that I knew it needed 7.. But thought wrong...