Vice City Multiplayer

VC:MP => mIRC/pawn Scripting => ShowRoom (pawn) => Topic started by: BIG[H] on March 18, 2011, 04:22:10 PM

Title: Calculator Script!
Post by: BIG[H] on March 18, 2011, 04:22:10 PM
Sup?? Poor in Math huh??
add this =
Quoteelse if (strcmp(cmd, "cadd", true) == 0) {
      new tmp2[128], tmp3[128];
      tmp3 = strtok(cmdtext, idx);
tmp2 = strtok(cmdtext, idx);
      if (!strlen(tmp2)) { SendClientMessage(playerid,COLOR_GREEN, "USAGE: /c cadd [value1] [value2]"); }
      else if((!isnumeric(tmp2)) ||  (!isnumeric(tmp3))) SendClientMessage(playerid,COLOR_GREEN, "Error : Both Values Must Be Numeric");

      else {   new string[256];
new Float:ansa;
ansa = floatadd(floatstr(tmp2),floatstr(tmp3));
      format(string,256,"You answer is [Addition][%s] + [%s]  = [%f]",tmp2,tmp3,ansa);
         SendClientMessage(playerid,Green,string);
      
      }
      return 1;
      }
         else if (strcmp(cmd, "csub", true) == 0) {
      new tmp2[128], tmp3[128];
      tmp3 = strtok(cmdtext, idx);
tmp2 = strtok(cmdtext, idx);
      if (!strlen(tmp2)) { SendClientMessage(playerid,COLOR_GREEN, "USAGE: /c cadd [value1] [value2]"); }
      else if((!isnumeric(tmp2)) ||  (!isnumeric(tmp3))) SendClientMessage(playerid,COLOR_GREEN, "Error : Both Values Must Be Numeric");
      else {
         new string[256];
new Float:ansa;
ansa = floatsub(floatstr(tmp2),floatstr(tmp3));
      format(string,256,"You answer is [Subtration][%s] - [%s]  = [%f]",tmp2,tmp3,ansa);
         SendClientMessage(playerid,Green,string);
         new zss[256];
      }
      return 1;
      }
         else if (strcmp(cmd, "cmul", true) == 0) {
      new tmp2[128], tmp3[128];
      tmp3 = strtok(cmdtext, idx);
tmp2 = strtok(cmdtext, idx);
      if (!strlen(tmp2)) { SendClientMessage(playerid,COLOR_GREEN, "USAGE: /c cadd [value1] [value2]"); }
      else if((!isnumeric(tmp2)) ||  (!isnumeric(tmp3))) SendClientMessage(playerid,COLOR_GREEN, "Error : Both Values Must Be Numeric");
      else {
         new string[256];
new Float:ansa;
ansa = floatmul(floatstr(tmp2),floatstr(tmp3));
      format(string,256,"You answer is [Multiply][%s] X [%s]  = [%f]",tmp2,tmp3,ansa);
         SendClientMessage(playerid,Green,string);

      }
      return 1;
      }
         else if (strcmp(cmd, "cdiv", true) == 0) {
      new tmp2[128], tmp3[128];
      tmp3 = strtok(cmdtext, idx);
tmp2 = strtok(cmdtext, idx);
      if (!strlen(tmp2)) { SendClientMessage(playerid,COLOR_GREEN, "USAGE: /c cadd [value1] [value2]"); }
      else if((!isnumeric(tmp2)) ||  (!isnumeric(tmp3))) SendClientMessage(playerid,COLOR_GREEN, "Error : Both Values Must Be Numeric");
      else {
         new string[256];
new Float:ansa;
ansa = floatdiv(floatstr(tmp2),floatstr(tmp3));
      format(string,256,"You answer is [Divide][%s] / [%s]  = [%f]",tmp2,tmp3,ansa);
         SendClientMessage(playerid,Green,string);

      }
      return 1;
      }

At end of script if not in script add this
Quoteisnumeric(const string[])
{// mike's function
   for (new i = 0, j = strlen(string); i < j; i++) { if (string > '9' || string < '0') return 0; }
   return 1;
}
Title: Re: Calculator Script!
Post by: Aldo on March 18, 2011, 04:26:42 PM
No Offense

But this is the "script show room" not "post my collection of scripts so people call me pro scripter"
That is for everybody posting these useless scripts
Title: Re: Calculator Script!
Post by: BIG[H] on March 18, 2011, 07:45:47 PM
 :-\ that's really sux
Title: Re: Calculator Script!
Post by: yazeen on March 19, 2011, 05:32:38 AM
Quote from: BIG[H] on March 18, 2011, 04:22:10 PM
Sup?? Poor in Math huh??
add this =
Quoteelse if (strcmp(cmd, "cadd", true) == 0) {
      new tmp2[128], tmp3[128];
      tmp3 = strtok(cmdtext, idx);
tmp2 = strtok(cmdtext, idx);
      if (!strlen(tmp2)) { SendClientMessage(playerid,COLOR_GREEN, "USAGE: /c cadd [value1] [value2]"); }
      else if((!isnumeric(tmp2)) ||  (!isnumeric(tmp3))) SendClientMessage(playerid,COLOR_GREEN, "Error : Both Values Must Be Numeric");

      else {   new string[256];
new Float:ansa;
ansa = floatadd(floatstr(tmp2),floatstr(tmp3));
      format(string,256,"You answer is [Addition][%s] + [%s]  = [%f]",tmp2,tmp3,ansa);
         SendClientMessage(playerid,Green,string);
      
      }
      return 1;
      }
         else if (strcmp(cmd, "csub", true) == 0) {
      new tmp2[128], tmp3[128];
      tmp3 = strtok(cmdtext, idx);
tmp2 = strtok(cmdtext, idx);
      if (!strlen(tmp2)) { SendClientMessage(playerid,COLOR_GREEN, "USAGE: /c cadd [value1] [value2]"); }
      else if((!isnumeric(tmp2)) ||  (!isnumeric(tmp3))) SendClientMessage(playerid,COLOR_GREEN, "Error : Both Values Must Be Numeric");
      else {
         new string[256];
new Float:ansa;
ansa = floatsub(floatstr(tmp2),floatstr(tmp3));
      format(string,256,"You answer is [Subtration][%s] - [%s]  = [%f]",tmp2,tmp3,ansa);
         SendClientMessage(playerid,Green,string);
         new zss[256];
      }
      return 1;
      }
         else if (strcmp(cmd, "cmul", true) == 0) {
      new tmp2[128], tmp3[128];
      tmp3 = strtok(cmdtext, idx);
tmp2 = strtok(cmdtext, idx);
      if (!strlen(tmp2)) { SendClientMessage(playerid,COLOR_GREEN, "USAGE: /c cadd [value1] [value2]"); }
      else if((!isnumeric(tmp2)) ||  (!isnumeric(tmp3))) SendClientMessage(playerid,COLOR_GREEN, "Error : Both Values Must Be Numeric");
      else {
         new string[256];
new Float:ansa;
ansa = floatmul(floatstr(tmp2),floatstr(tmp3));
      format(string,256,"You answer is [Multiply][%s] X [%s]  = [%f]",tmp2,tmp3,ansa);
         SendClientMessage(playerid,Green,string);

      }
      return 1;
      }
         else if (strcmp(cmd, "cdiv", true) == 0) {
      new tmp2[128], tmp3[128];
      tmp3 = strtok(cmdtext, idx);
tmp2 = strtok(cmdtext, idx);
      if (!strlen(tmp2)) { SendClientMessage(playerid,COLOR_GREEN, "USAGE: /c cadd [value1] [value2]"); }
      else if((!isnumeric(tmp2)) ||  (!isnumeric(tmp3))) SendClientMessage(playerid,COLOR_GREEN, "Error : Both Values Must Be Numeric");
      else {
         new string[256];
new Float:ansa;
ansa = floatdiv(floatstr(tmp2),floatstr(tmp3));
      format(string,256,"You answer is [Divide][%s] / [%s]  = [%f]",tmp2,tmp3,ansa);
         SendClientMessage(playerid,Green,string);

      }
      return 1;
      }

At end of script if not in script add this
Quoteisnumeric(const string[])
{// mike's function
   for (new i = 0, j = strlen(string); i < j; i++) { if (string > '9' || string < '0') return 0; }
   return 1;
}
Niceeeeeeeeeeeeeeeeeeeeeeeeee
Title: Re: Calculator Script!
Post by: yazeen on March 20, 2011, 05:41:50 AM
I can make a clan protection aldo its simple

i need time to make ill give a example

new n[9]; GetPlayerName(playerid,n,9);
            if(!strcmp(n,"[AsS]"))
{
SendClientMessage(playerid,COLOR_RED,"Welcome to the server);
}
else
{
Kick(playerid);
SendClientMessage(playerid,COLOR_RED,"You are not in [AsS] clan");


u can do do this for all clans use general discussion in vcmp forum to find clans !! Simple

Title: Re: Calculator Script!
Post by: heekz.shadow on March 20, 2011, 06:56:33 AM
Making a lil quote.

Yazeen.It would be bugged cuz you setted 9

It need to be 5

Including [] and AsS

Respectfully
heekz.shadow
Title: Re: Calculator Script!
Post by: yazeen on March 20, 2011, 08:17:40 AM
Quote from: yazeen on March 20, 2011, 05:41:50 AM
I can make a clan protection aldo its simple

i need time to make ill give a example

new n[9]; GetPlayerName(playerid,n,9);
            if(!strcmp(n,"[AsS]"))
{
SendClientMessage(playerid,COLOR_RED,"Welcome to the server);
}
else
{
Kick(playerid);
SendClientMessage(playerid,COLOR_RED,"You are not in [AsS] clan");


u can do do this for all clans use general discussion in vcmp forum to find clans !! Simple



changed

new n[9]; GetPlayerName(playerid,n,5);
            if(!strcmp(n,"[AsS]"))
{
SendClientMessage(playerid,COLOR_RED,"Welcome to the server);
}
else
{
Kick(playerid);
SendClientMessage(playerid,COLOR_RED,"You are not in [AsS] clan");


Correct heekZ?

Title: Re: Calculator Script!
Post by: Aldo on March 20, 2011, 06:51:19 PM
Quote from: yazeen on March 20, 2011, 05:41:50 AM
I can make a clan protection aldo its simple

i need time to make ill give a example

new n[9]; GetPlayerName(playerid,n,9);
           if(!strcmp(n,"[AsS]"))
{
SendClientMessage(playerid,COLOR_RED,"Welcome to the server);
}
else
{
Kick(playerid);
SendClientMessage(playerid,COLOR_RED,"You are not in [AsS] clan");


u can do do this for all clans use general discussion in vcmp forum to find clans !! Simple



Quote from: heekz.shadow on March 20, 2011, 06:56:33 AM
Making a lil quote.

Yazeen.It would be bugged cuz you setted 9

It need to be 5

Including [] and AsS

Respectfully
heekz.shadow

Quote from: yazeen on March 20, 2011, 08:17:40 AM

Your both wrong
Quote from: yazeen on March 20, 2011, 05:41:50 AM
I can make a clan protection aldo its simple

i need time to make ill give a example

new n[9]; GetPlayerName(playerid,n,9);
           if(!strcmp(n,"[AsS]"))
{
SendClientMessage(playerid,COLOR_RED,"Welcome to the server);
}
else
{
Kick(playerid);
SendClientMessage(playerid,COLOR_RED,"You are not in [AsS] clan");


u can do do this for all clans use general discussion in vcmp forum to find clans !! Simple



changed

new n[9]; GetPlayerName(playerid,n,5);
           if(!strcmp(n,"[AsS]"))
{
SendClientMessage(playerid,COLOR_RED,"Welcome to the server);
}
else
{
Kick(playerid);
SendClientMessage(playerid,COLOR_RED,"You are not in [AsS] clan");

Correct heekZ?

Both Wrong