Need Help -
Edward2013 - 22.07.2013
I have two commands in one gamemode with the same code, but different weapons. When I try to compile it I get this: error 021: symbol already defined: "weapons". How to fix it?
Код:
if (strcmp(cmd, "/beanbagshot", true) == 0 || strcmp(cmd, "/bbs", true) == 0)
{
if(IsACop(playerid) && PlayerInfo[playerid][pDuty] == 1)
{
new weapons[13][2];
for (new i = 0; i < 13; i++)
{
GetPlayerWeaponData(playerid, i, weapons[i][0], weapons[i][1]);
}
if(Tazer[playerid] == 0)
{
if(PlayerInfo[playerid][pTazerBullets] != 0)
{
new ammo = weapons[2][1];
PreTazerAmmo[playerid] = ammo;
SafeGivePlayerWeapon(playerid, 25, PlayerInfo[playerid][pTazerBullets]);
Tazer[playerid] = 1;
SetPlayerSkillLevel(playerid, WEAPONSKILL_SHOTGUN, 500);
OnePlayAnim(playerid,"SWORD","sword_block",50.0,0,1,1,1,1);
ProxDetector(30.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
}
else
{
SendClientMessage(playerid, COLOR_GREY,"* No beanbag rounds!");
return 1;
}
}
else
{
new ammo = weapons[2][1];
PlayerInfo[playerid][pTazerBullets] = ammo;
SafeGivePlayerWeapon(playerid, 25, PreTazerAmmo[playerid]);
AttachWeaponCorrectly(playerid, 25);
Tazer[playerid] = 0;
ClearAnimations(playerid);
SetPlayerSkillLevel(playerid, WEAPONSKILL_SHOTGUN, PlayerInfo[playerid][pSilenSkill]);
format(string, sizeof(string), "* %s .", sendername);
ProxDetector(30.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
}
}
return 1;
}
Код:
if(strcmp(cmd, "/tazer", true) ==0 || strcmp(cmd, "/ta", true) ==0 || strcmp(cmd, "/taser", true) ==0)
{
if(IsACop(playerid) && PlayerInfo[playerid][pDuty] == 1)
{
new weapons[13][2];
for (new i = 0; i < 13; i++)
{
GetPlayerWeaponData(playerid, i, weapons[i][0], weapons[i][1]);
}
if(Tazer[playerid] == 0)
{
if(PlayerInfo[playerid][pTazerBullets] != 0)
{
new ammo = weapons[2][1];
PreTazerAmmo[playerid] = ammo;
SafeGivePlayerWeapon(playerid, 23, PlayerInfo[playerid][pTazerBullets]);
Tazer[playerid] = 1;
SetPlayerSkillLevel(playerid, WEAPONSKILL_PISTOL_SILENCED, 500);
OnePlayAnim(playerid,"SWORD","sword_block",50.0,0,1,1,1,1);
ProxDetector(30.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
}
else
{
SendClientMessage(playerid, COLOR_GREY,"* No ammo!");
return 1;
}
}
else
{
new ammo = weapons[2][1];
PlayerInfo[playerid][pTazerBullets] = ammo;
SafeGivePlayerWeapon(playerid, 23, PreTazerAmmo[playerid]);
AttachWeaponCorrectly(playerid, 23);
Tazer[playerid] = 0;
ClearAnimations(playerid);
SetPlayerSkillLevel(playerid, WEAPONSKILL_PISTOL_SILENCED, PlayerInfo[playerid][pSilenSkill]);
format(string, sizeof(string), "* %s .", sendername);
ProxDetector(30.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
}
}
return 1;
}