floatsqroot
#1

Hi , I have some problems. I created an calculator script so I came to the root cmd. I created it but i don't know what's wrong with the code whatever the number I enter it always gives me the results like 10821082 and that stuff.

So can somebody make my code working?

pawn Код:
YCMD:root(playerid,params[],help) {
            #pragma unused help
            new sq,Float:res,str[128];
            if(sscanf(params, "i", sq)) return SendClientMessage(playerid,-1,"USAGE: /root [number]");
            res = floatsqroot(sq);
            format(str,sizeof str,"RESULT: %i",res);
            SendClientMessage(playerid,-1,str); return true; }
Reply
#2

pawn Код:
YCMD:root(playerid,params[],help) {
            #pragma unused help
            new sq,Float:res,str[128];
            if(sscanf(params, "i", sq)) return SendClientMessage(playerid,-1,"USAGE: /root [number]");
            res = floatsqroot(sq);
            format(str,sizeof str,"RESULT: %f",res);
            SendClientMessage(playerid,-1,str); return true; }
Reply
#3

Thanks ! I forgot that %f is for floats ! Silly mistake Thanks again.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)