Vice City Multiplayer

VC:MP => mIRC/pawn Scripting => Topic started by: chn batista on March 03, 2010, 02:14:01 PM

Title: a little question
Post by: chn batista on March 03, 2010, 02: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"; ?
Title: Re: a little question
Post by: Boss on March 03, 2010, 02: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:

if(weaponid != 33) GivePlayerWeapon(playerid,weaponid,9999);
else SendClientMessage(playerid,COLOR_GRAY,"No minigun for you, sorry.");
Title: Re: a little question
Post by: chn batista on March 03, 2010, 03:17:17 PM
thanks i made it like this
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;
}
Title: Re: a little question
Post by: Boss on March 03, 2010, 03: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:

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;
}
Title: Re: a little question
Post by: chn batista on March 03, 2010, 03:31:00 PM
thanks Boss  :)