how to get a float argument
#1

am build a plugin and i need get a float argument to my function

sorry for me bad english
Reply
#2

amx_ctof(params[1]) ?? this always returns 0.00000
Reply
#3

Код:
static cell AMX_NATIVE_CALL n_gpfa( AMX* amx, cell* params )
{
	double x = amx_ctof(params[1]);
	logprintf("distance: %f", x);
native gpfa(&Float:distance);
Reply
#4

ok thx

one more: what is the PI number in float ?? 3.14 ... is a double and i need float
Reply
#5

PI... 'f'(in end)
or (float)PI
Reply
#6

I use floats. I think most of the games use floats. Correct me if I'm wrong.
Is there a noticeable difference between floats and doubles?
Reply
#7

2 more questions

1. how to use sa:mp function, i need IsPlayerConnected

and 2. how to use public function, OnPlayerDisconnect (after is load in gamemodes & filterscripts)
Reply
#8

the max functions argument value is 2147483647 ?? more get a negative value
Reply
#9

Quote:
Originally Posted by Terminator3
Посмотреть сообщение
1. how to use sa:mp function, i need IsPlayerConnected
PawnCommand, if you have the patience to fiddle around with it.

Quote:
Originally Posted by Terminator3
Посмотреть сообщение
and 2. how to use public function, OnPlayerDisconnect (after is load in gamemodes & filterscripts)
Call it from the gamemode...

public OnPlayerDisconnect(playerid, reason) return plugin_OnPlayerDisconnect(playerid,reason);

Or if you're up for a challenge you could try the memory hacking approach, but that's frowned upon here.
Reply
#10

i have probably PawnCommand but how to use it ?

i need one simple function, IsPlayerConnected
Reply
#11

Quote:
Originally Posted by Terminator3
Посмотреть сообщение
i have probably PawnCommand but how to use it ?

i need one simple function, IsPlayerConnected
There was someone (I can't remember who) posting an "invoke" package including the SDK, tutorials and pawn command with examples.
Here is it:
http://remis.square7.net/tests/Plugi...okePackage.zip
or look at my attachment.

Read the "Usage(README).txt":
Quote:

-Using PAWN functions in your plugin
---------------------------------------------------------------------
**View the examples in action in the "HelloWorld/helloworld.cpp" file!!!
Parameters:
i = integer
f = float value
s = string
v = variable
p = string var (GetPlayerName etc.)

There are 5 types of parameters that can be used for PAWN functions.
All parameters except variables ("v") and string variables ("b") can be used directly, as in this example:


//PutPlayerAtCenterOfWorld(int playerid)
int playerid = params[1];
float x = 0.0,y = 0.0,z = 0.0;
PawnCommand(&SetPlayerPos,playerid,x,y,z);


To use variable, you must use the "&" sign before the variable/stringvariable, as in this example:


GetPlayerPositionAndPrint(int playerid)
int playerid = params[1];
float x,y,z;
PawnCommand(&GetPlayerPos,playerid,&x,&y,&z);


You use the & sign to store the value of whatever you are getting.

And here is the PawnCommand readme by Peter:
http://pastebin.com/KusHkBAd (included in the package).

But Iam sure SSI, YSF and the streamer plugin have a better way of doing this, just look into their source code.
Reply
#12

I never had much luck getting Peter's invoke working. I suggest extracting Incognito's from his streamer source code. His works perfectly.
Reply
#13

Quote:
Originally Posted by cyber_punk
Посмотреть сообщение
I never had much luck getting Peter's invoke working. I suggest extracting Incognito's from his streamer source code. His works perfectly.
Which one is faster?
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)