Author Topic: a little question  (Read 3410 times)

0 Members and 2 Guests are viewing this topic.

Offline chn batista

  • Wiseguy
  • **
  • Posts: 66
  • nothing
    • View Profile
a little question
« on: March 03, 2010, 04:14:01 pm »
gWeapons[33] = "Minigun";
i found it in pwn file i don't want player get minigun by !wep command
i should change to gWeapons[33] = "none"; ?

Offline Boss

  • VC:MP Beta Tester (inactive)
  • Made Man
  • *
  • Posts: 229
  • Boss
    • View Profile
    • TDH Clan Site
Re: a little question
« Reply #1 on: March 03, 2010, 04:29:58 pm »
No, it will just change weapon's name in whereever you use it (or nowhere if you don't). To disable giving minigun you should add a check in your !wep command like this:
Code: [Select]
if(weaponid != 33) GivePlayerWeapon(playerid,weaponid,9999);
else SendClientMessage(playerid,COLOR_GRAY,"No minigun for you, sorry.");

Offline chn batista

  • Wiseguy
  • **
  • Posts: 66
  • nothing
    • View Profile
Re: a little question
« Reply #2 on: March 03, 2010, 05:17:17 pm »
thanks i made it like this
Code: [Select]
else if (strcmp(cmd, "!wep", true) == 0) {
    new tmp2[256], wep;
tmp = strtok(cmdtext, idx), tmp2 = strtok(cmdtext, idx);
        if(wep_init != 33) GivePlayerWeapon(playerid,0,1);
        else SendClientMessage(playerid,COLOR_RED,"No minigun for you, sorry.");
        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;
}

Offline Boss

  • VC:MP Beta Tester (inactive)
  • Made Man
  • *
  • Posts: 229
  • Boss
    • View Profile
    • TDH Clan Site
Re: a little question
« Reply #3 on: March 03, 2010, 05:27:43 pm »
Um... I can't find even a slightest glimpse of logic in why did you put it there or in why did you use wep_init (which is a bool for whether the weapons list was initialized). The correct command:
Code: [Select]
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);
if(wep != 33) SetPlayerWeapon(playerid,wep,strval(tmp2));
else SendClientMessage(playerid,COLOR_RED,"No minigun for you, sorry.");
}
return 1;
}

Offline chn batista

  • Wiseguy
  • **
  • Posts: 66
  • nothing
    • View Profile
Re: a little question
« Reply #4 on: March 03, 2010, 05:31:00 pm »
thanks Boss  :)