how to get a float argument -
Terminator3 - 31.08.2010
am build a plugin and i need get a float argument to my function
sorry for me bad english
Re: how to get a float argument -
Terminator3 - 31.08.2010
amx_ctof(params[1]) ?? this always returns 0.00000
Re: how to get a float argument -
Terminator3 - 31.08.2010
Код:
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);
Re: how to get a float argument -
Terminator3 - 31.08.2010
ok thx
one more: what is the PI number in float ?? 3.14 ... is a double and i need float
Re: how to get a float argument -
Aleks10 - 31.08.2010
PI... 'f'(in end)
or (float)PI
Re: how to get a float argument -
hencz - 31.08.2010
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?
Re: how to get a float argument -
Terminator3 - 01.09.2010
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)
Re: how to get a float argument -
Terminator3 - 02.09.2010
the max functions argument value is 2147483647 ?? more get a negative value
Re: how to get a float argument -
RoBo - 02.09.2010
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.
Re: how to get a float argument -
Terminator3 - 02.09.2010
i have probably PawnCommand but how to use it ?
i need one simple function, IsPlayerConnected
Re: how to get a float argument -
Remis - 04.09.2010
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.
Re: how to get a float argument -
cyber_punk - 04.09.2010
I never had much luck getting Peter's invoke working. I suggest extracting Incognito's from his streamer source code. His works perfectly.
Re: how to get a float argument -
RoBo - 05.09.2010
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?