Author Topic: help for short weapon command  (Read 4151 times)

0 Members and 3 Guests are viewing this topic.

Offline johnx

  • Street Thug
  • *
  • Posts: 25
    • View Profile
help for short weapon command
« on: December 15, 2010, 04:28:54 pm »
i am using gups but there is one problem in weapon cmd it is to long can anyone know how to short it
form !wep stubby 999
example:
/c stubby
/c wep stubby
here is command

Quote
   }
   else if (strcmp(cmd, "!wep", true) == 0) {
       new tmp2[256], wep;
      tmp = strtok(cmdtext, idx), tmp2 = strtok(cmdtext, idx);
      if(PlayerInfo[playerid][Logged] != 1) SendClientMessage(playerid, COLOR_RED, "You need to login first!");
      else if (!strlen(tmp2)) SendClientMessage(playerid, COLOR_GREEN, "USAGE: !wep [WeaponName/ID] ammo");
      else {
         wep = FindWepIDFromString(tmp);
         SetPlayerWeapon(playerid,wep,strval(tmp2));
      }
      return 1;
   }
« Last Edit: December 15, 2010, 07:53:22 pm by johnx »

Offline Terminatorupgrade 2

  • Wiseguy
  • **
  • Posts: 91
  • pawno scripter
    • View Profile
Re: help for short weapon command
« Reply #1 on: December 15, 2010, 06:21:28 pm »
yes

Quote
else if (strcmp(cmd, "!Stubby", true) == 0) {
       new tmp2[256], wep;
      tmp = strtok(cmdtext, idx), tmp2 = strtok(cmdtext, idx);
      if(PlayerInfo[playerid][Logged] != 1) SendClientMessage(playerid, COLOR_RED, "You need to login first!");
      else {
         SetPlayerWeapon(playerid,21,9999);
      }
      return 1;
   }

hope this helps

Offline johnx

  • Street Thug
  • *
  • Posts: 25
    • View Profile
Re: help for short weapon command
« Reply #2 on: December 15, 2010, 07:52:58 pm »
hy i need all guns short command not only stubby  i mean /c spaz /c stubby or /c /c wep spaz /c wep m4 like that not !stubby

Offline Terminatorupgrade 2

  • Wiseguy
  • **
  • Posts: 91
  • pawno scripter
    • View Profile
Re: help for short weapon command
« Reply #3 on: December 15, 2010, 09:22:19 pm »
O--------------------M------------------------G



you just have to change !stubby to wep name
E.G
else if (strcmp(cmd, "Stubby", true) == 0) {
to
else if (strcmp(cmd, "M4", true) == 0) {


and 2nd thing u just have to change
 e.g
SetPlayerWeapon(playerid,21,9999);

to

SetPlayerWeapon(playerid,26,9999);


21 to 26
and take help of vcmp_doc weapon id list Pdf file that you have [Lovely.Sky]

or anyone give link of that!

any put this in
OnPlayerCommand

« Last Edit: December 15, 2010, 09:25:14 pm by Terminatorupgrade 2 »

Offline johnx

  • Street Thug
  • *
  • Posts: 25
    • View Profile
Re: help for short weapon command
« Reply #4 on: December 16, 2010, 09:54:40 am »
noob i dont want make a command for one weapon like !stubby then !spaz lol i dont like that
i just need /c spaz os /c wep spaz for there we can take all guns not one

Offline Madara

  • Street Thug
  • *
  • Posts: 48
    • View Profile
Re: help for short weapon command
« Reply #5 on: December 16, 2010, 10:08:06 am »
Quote
Terminatorupgrade 2 :
Quote
else if (strcmp(cmd, "!Stubby", true) == 0) {
       new tmp2[256], wep;
      tmp = strtok(cmdtext, idx), tmp2 = strtok(cmdtext, idx);
      if(PlayerInfo[playerid][Logged] != 1) SendClientMessage(playerid, COLOR_RED, "You need to login first!");
      else {
         SetPlayerWeapon(playerid,21,9999);
      }
      return 1;
   }

No need to:
       new tmp2 [256], wep;
       tmp = strtok (cmdtext, idx), tmp2 = strtok (cmdtext, idx);
Since these indicating a direct weapon, in this case the stubby.

Johnx Now, you do not want to type /c wep [weapon/id] [ammo], you just type in the weapon you want and nothing else, that is, /c wep [weapon/id], or am I wrong? , well, here I leave the command, just replace it for you have and when you type / c wep, you just ask for the weapon, not ammunition. (you can type either /c we or /c wep)

Code: [Select]
else if (strcmp(cmd, "we", true) == 0 || strcmp(cmd, "wep", true) == 0) {
tmp = strtok(cmdtext, idx);
if(PlayerInfo[playerid][Logged] != 1) SendClientMessage(playerid, COLOR_RED, "** pm >> You need to login first!");
else if (!strlen(tmp)) format(szMsg,256,"** pm >> [Syntax] - The correct use: /c %s [weapon/id].", cmdtext) && SendClientMessage(playerid,COLOR_GREEN,szMsg);
else {
                          new wep = FindWepIDFromString(tmp);
 format(szMsg,256,"** pm >> Recived Weapon: %s - Ammo: 9999.",gWeapons[wep]);
 SendClientMessage(playerid,COLOR_GREEN,szMsg);
 SetPlayerWeapon(playerid,wep,9999);
}
return 1;
}

Check it out and tell me how you did.
Greetings ;)
« Last Edit: December 16, 2010, 10:52:08 am by Madara »

Offline johnx

  • Street Thug
  • *
  • Posts: 25
    • View Profile
Re: help for short weapon command
« Reply #6 on: December 16, 2010, 11:18:41 am »
not working!!!!!!!!!!

Offline Madara

  • Street Thug
  • *
  • Posts: 48
    • View Profile
Re: help for short weapon command
« Reply #7 on: December 16, 2010, 11:58:34 am »
I isn't for you, for where's written "wep", instead of putting "! wep", because I guess that goes in the "OnPlayerText (playerid, cmdtext [])", right?, well, try it with this:

Code: [Select]
else if (strcmp(cmd, "!we", true) == 0 || strcmp(cmd, "!wep", true) == 0) {
tmp = strtok(cmdtext, idx);
if(PlayerInfo[playerid][Logged] != 1) SendClientMessage(playerid, COLOR_RED, "** pm >> You need to login first!");
else if (!strlen(tmp)) format(szMsg,256,"** pm >> [Syntax] - The correct use: %s [weapon/id].", cmdtext) && SendClientMessage(playerid,COLOR_GREEN,szMsg);
else {
                          new wep = FindWepIDFromString(tmp);
 format(szMsg,256,"** pm >> Recived Weapon: %s - Ammo: 9999.",gWeapons[wep]);
 SendClientMessage(playerid,COLOR_GREEN,szMsg);
 SetPlayerWeapon(playerid,wep,9999);
}
return 1;
}
« Last Edit: December 16, 2010, 12:01:45 pm by Madara »

Offline Terminatorupgrade 2

  • Wiseguy
  • **
  • Posts: 91
  • pawno scripter
    • View Profile
Re: help for short weapon command
« Reply #8 on: December 16, 2010, 12:02:44 pm »
ya right ;)