• Welcome to Vice City Multiplayer.
 

help for short weapon command

Started by johnx, December 15, 2010, 01:28:54 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

johnx

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;
   }

Terminatorupgrade 2

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

johnx

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

Terminatorupgrade 2

#3
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


johnx

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

Madara

#5
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 ;)

johnx


Madara

#7
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;
}

Terminatorupgrade 2