SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Tutorials

Thread Tools Display Modes
Old 05/09/2012, 02:39 PM   #11
leonardo1434's Avatar
Join Date: Mar 2012
Posts: 1,688
Reputation: 179
Default Re: Making Basic calculator commands.

made this quickly don't even tested but it should work much better than yours.
pawn Code:
   new Float:n1,signal[2],Float:n2,str[30];
   if(sscanf(params, "fs[2]f", n1,signal, n2)) return SendClientMessage(playerid, -1, "Usage: /calc number (+,-,/,*) number(Ex: /calc number + number )");
   switch (signal[0])
       case '+':
           format(str,sizeof str,"%.2f + %.2f = %.2f",n1,n2,n1 + n2);
       case '-':
          format(str,sizeof str,"%.2f - %.2f = %.2f",n1,n2,n1 - n2);
       case '/':
          format(str,sizeof str,"%.2f / %.2f = %.2f",n1,n2,n1 / n2);
       case '*':
          format(str,sizeof str,"%.2f * %.2f = %.2f",n1,n2,n1 * n2);
   return 1;
leonardo1434 is offline   Reply With Quote
Old 05/09/2012, 02:43 PM   #12
Beta Tester
Y_Less's Avatar
Join Date: Jun 2008
Location: 629 -
Posts: 17,814
Reputation: 2473
Default Re: Making Basic calculator commands.

Originally Posted by TaLhA XIV View Post
I know this is a slow way and cause the newbies would not use zcmd and things the first day,And I said that this was for newbies not for pro's like you ,thanks for the reply.
That is WHY you should use ZCMD! Not doing so only propagates poor coding practice which, by the way, is one of the things I said NOT to do in the tutorial on writing tutorials! If you claim you're not teaching them ZCMD because they don't know ZCMD, then how do you expect them to learn it?
Y_Less is online now   Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Tutorial] Making basic commands [ZCMD] Gangs_Rocks Tutorials 8 06/07/2013 09:10 PM
[FilterScript] Romel's Calculator [Simple and Easy!] - No more using calculator _Jake_ Filterscripts 18 01/09/2012 10:02 AM
[HELP]Basic RP Commands [rep+] SiEx Scripting Help 2 15/04/2012 12:27 AM

All times are GMT. The time now is 10:14 AM.

Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.