SA-MP Forums [Tutorial] Making Basic calculator commands.
 New Account Members List Search Today's Posts Mark Forums Read

 05/09/2012, 02:39 PM #11 leonardo1434 High-roller     Join Date: Mar 2012 Posts: 1,673 Reputation: 179 Re: Making Basic calculator commands. made this quickly don't even tested but it should work much better than yours. Code: ```CMD:calc(playerid,params[]) { 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); } } SendClientMessage(playerid,-1,str); return 1; }``` __________________ c++
05/09/2012, 02:43 PM   #12
Y_Less
Spam Machine

Join Date: Jun 2008
Location: 629 - git.io/Y
Posts: 14,606
Reputation: 3039
Re: Making Basic calculator commands.

Quote:
 Originally Posted by TaLhA XIV 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?
__________________
 | Worst. Exit. Ever. |
 | git.io/Y | y-less.com | jump.pk |

 Thread Tools Display Modes Linear Mode

 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 Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post [Tutorial] Making basic commands [ZCMD] Gangs_Rocks Tutorials 8 06/07/2013 09:10 PM JaKe Elite Filterscripts 18 01/09/2012 10:02 AM SiEx Scripting Help 2 15/04/2012 12:27 AM

All times are GMT. The time now is 06:46 PM.

 -- (EN) English -- (RU) Русски Contact Us - SA-MP - Archive - Top