Author Topic: GCS a.2 with VCMD  (Read 3357 times)

0 Members and 1 Guest are viewing this topic.

Offline VS

  • Street Thug
  • *
  • Posts: 37
  • Opening Soon - VS Society
    • View Profile
GCS a.2 with VCMD
« on: January 09, 2013, 08:02:52 pm »
GCS

http://www35.zippyshare.com/v/40717977/file.html

Hello VC:MP this is the second part of GCS with couple more scripts explaining VCMD and i have created something new same as this example will show you.

[pawn]
if(strcmp(cmdtext,"", true) == 0)
[/pawn]

but mine is a little more like this

[pawn]
vcmp(cmdtext,"", true)
[/pawn]

when you are scripting and you have to do

[pawn]
if(strcmp(cmdtext,"", true) == 0)

else if(strcmp(cmdtext,"", true) == 0)
[/pawn]

and stuff like that i have made it where ELSE is no longer needed

ether this way
[pawn]
public OnPlayerCommandText(playerid, cmdtext[])
{
vcmd_heal(playerid, cmdtext);
}

vcmd:heal(playerid,params[])
{
   new idx, vStin[128];
   vStin = strtok(params, idx);

   new Float:Health;
   GetPlayerHealth(playerid,Health);
   if(Health > 50)
   {
      SendClientMessage(playerid,0xFFFFFFAA,"Your health isn't past 50%");
   }
   else
   {
       SetPlayerHealth(playerid, 100.0);
       SendClientMessage(playerid,0xFFFFFFAA,"Your health has now been reset to 100%");
   }
   return 1;
}
[/pawn]

or this way

[pawn]
public OnPlayerCommandText(playerid, cmdtext[])
{
   vcmp(vStin,"heal",true)
   {
      new idx, vStin[128];
      vStin = strtok(params, idx);

      new Float:Health;
      GetPlayerHealth(playerid,Health);
      if(Health > 50)
      {
         SendClientMessage(playerid,0xFFFFFFAA,"Your health isn't past 50%");
      }
      else
      {
          SetPlayerHealth(playerid, 100.0);
          SendClientMessage(playerid,0xFFFFFFAA,"Your health has now been reset to 100%");
      }
       return 1;
   }
   vcmp(vStin,"heal2",true)
   {
      new idx, vStin[128];
      vStin = strtok(params, idx);

      new Float:Health;
      GetPlayerHealth(playerid,Health);
      if(Health > 50)
      {
         SendClientMessage(playerid,0xFFFFFFAA,"Your health isn't past 50%");
      }
      else
      {
          SetPlayerHealth(playerid, 100.0);
          SendClientMessage(playerid,0xFFFFFFAA,"Your health has now been reset to 100%");
      }
       return 1;
   }
}
[/pawn]

the GCS script is for any one that likes new ways to script

this script is

Newbie friendly
Pro friendly
legend friendly

doesn't matter at all
« Last Edit: January 09, 2013, 08:06:06 pm by VS »