• Welcome to Vice City Multiplayer.
 

a little question

Started by chn batista, March 03, 2010, 01:14:01 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

chn batista

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"; ?

Boss

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.");

chn batista

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

Boss

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

chn batista