float 1 and 2. - 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: float 1 and 2. (
/showthread.php?tid=367341)
float 1 and 2. -
TaLhA XIV - 09.08.2012
Hello,
I wanted to ask that how to get the float 1 and float to when added to a command?Let me explain:
Like if there is a command like /blabla <first number><second number>,
And then use it in my script like First float,Second float
You know that can be used to make a calculate I guess.
ThAnKs!.
Re: float 1 and 2. -
Jstylezzz - 09.08.2012
Depends, what floats are you getting?
the float the player inputs, or some other float?
if you search for the input, use sscanf..
simple command:
pawn Код:
CMD:output(playerid,params[])
{
new Float:f1,Float:f2;//make a new float var
if(sscanf(params,"ff",f1,f2)) return SendClientMessage(playerid,COLOR_WHITE,"Usage: /output <float1><float2>");//detect if the player has put in the floats
new Float:output = f1+f2;//count the floats
new string[128];//create string var
format(string,sizeof(string),"These two floats output: %f",output);//format the string var with our output
SendClientMessage(playerid,COLOR_WHITE,string);//send a message containing the formatted string
return 1;
}
this will count the floats to eachother