Coords Howto?
#1

Hello,

I have a question about using an X,Y,Z
I wanna use an X,Y,Z from one Public into another but I don't know how..

This is under the public
Code:
Код:
 new Float:posx,Float:posy,Float:z,Float:a;
 GetPlayerPos(playerid,posx,posy,z);
Then I wanna use the X,Y,Z in another public like:
Код:
CreateBomb(posx,posy,z+0.4,a);
When I do this I get "Undefined Symbol: posx"
Under the 2nd public

But I definitly have to use these coords, in the next public, how can I make this possible??

Thanks in advance
Reply
#2

You can declare the variables globally (At top of script).

Not in any callback or function.
Reply
#3

put
Код:
new Float:posx,Float:posy,Float:z,Float:a;
in top of you script
Reply
#4

You can use a timer.

pawn Код:
SetTimerEx("Public name", time in milisecounds, repeat, "format", parameters);

The format is (Quote from wiki):

pawn Код:
%b   Inserts a number at this position in binary radix
%c  Inserts a single character.
%d  Inserts an integer (whole) number
%f  Inserts a floating point number.
%i  Inserts an integer.
%s  Inserts a string.
%x  Inserts a number in hexadecimal notation.
%%  Inserts the literal '%
Then the parameters will be the posx, posy, etc.

repeat can be true or false.

True if the timer will constatly call the callback or false if the timer will call the callback just one time.

It's not the best explaination, so https://sampwiki.blast.hk/wiki/SetTimerEx
Reply
#5

Thanks to all of you guys
It worked finally

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)