Vice City Multiplayer

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

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