Vice City Multiplayer

VC:MP => mIRC/pawn Scripting => Topic started by: johnx on December 15, 2010, 02:28:54 PM

Title: help for short weapon command
Post by: johnx on December 15, 2010, 02: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;
   }
Title: Re: help for short weapon command
Post by: Terminatorupgrade 2 on December 15, 2010, 04:21:28 PM
yes

Quoteelse 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
Title: Re: help for short weapon command
Post by: johnx on December 15, 2010, 05: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
Title: Re: help for short weapon command
Post by: Terminatorupgrade 2 on December 15, 2010, 07: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

Title: Re: help for short weapon command
Post by: johnx on December 16, 2010, 07: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
Title: Re: help for short weapon command
Post by: Madara on December 16, 2010, 08:08:06 AM
QuoteTerminatorupgrade 2 :
Quoteelse 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)

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 ;)
Title: Re: help for short weapon command
Post by: johnx on December 16, 2010, 09:18:41 AM
not working!!!!!!!!!!
Title: Re: help for short weapon command
Post by: Madara on December 16, 2010, 09: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:

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;
}
Title: Re: help for short weapon command
Post by: Terminatorupgrade 2 on December 16, 2010, 10:02:44 AM
ya right ;)