stock GiveWeaponToPlayer(playerid,WeaponName[]) { // Pistols else if (!strcmp(WeaponName, "9mm", true && PlayerInfo[playerid][pRank] >=1)) // Rank 1+ { GivePlayerWeapon(playerid,22,20); //9mm } else if (!strcmp(WeaponName, "Silenced 9mm", true && PlayerInfo[playerid][pRank] >=5) { GivePlayerWeapon(playerid,23,20); // Silenced 9mm } else if (!strcmp(WeaponName, "Deagle", true && PlayerInfo[playerid][pRank] >=5) { GivePlayerWeapon(playerid,24,20); // Deagle } //Automatics else if (!strcmp(WeaponName, "Micro SMG", true && PlayerInfo[playerid][pRank] >=7) { GivePlayerWeapon(playerid,28,100); // Micro SMG } else if (!strcmp(WeaponName, "Tec 9", true && PlayerInfo[playerid][pRank] >=18) { GivePlayerWeapon(playerid,32,100); // tec9 } else if (!strcmp(WeaponName, "mp5", true && PlayerInfo[playerid][pRank] >=29) { GivePlayerWeapon(playerid,29,100); // mp5 } else if (!strcmp(WeaponName, "ak47", true && PlayerInfo[playerid][pRank] >=35) { GivePlayerWeapon(playerid,30,100); // ak47 } else if (!strcmp(WeaponName, "m4", true && PlayerInfo[playerid][pRank] >=42) { GivePlayerWeapon(playerid,31,100); // m4 } //Shotguns else if (!strcmp(WeaponName, "Barrel Shotgun", true && PlayerInfo[playerid][pRank] >=7) { GivePlayerWeapon(playerid,25,30); //barrel shotgun } else if (!strcmp(WeaponName, "Combat Shotgun", true && PlayerInfo[playerid][pRank] >=19) { GivePlayerWeapon(playerid,27,30); // combat shotgun } else if (!strcmp(WeaponName, "Sawnoff Shotgun", true && PlayerInfo[playerid][pRank] >=32) { GivePlayerWeapon(playerid,26,30); // sawnoff } //Rifles else if (!strcmp(WeaponName, "Country Rifle", true && PlayerInfo[playerid][pRank] >=9) { GivePlayerWeapon(playerid,33,30); // country rifle } else if (!strcmp(WeaponName, "Sniper Rifle", true && PlayerInfo[playerid][pRank] >=12) { GivePlayerWeapon(playerid,34,30); // sniper rifle } // Heavy Duty else if (!strcmp(WeaponName, "Flamethrower", true && PlayerInfo[playerid][pRank] >=19) { GivePlayerWeapon(playerid,37,15); // flamethrower } else if (!strcmp(WeaponName, "RPG", true && PlayerInfo[playerid][pRank] >=26) { GivePlayerWeapon(playerid,35,2); // rpg } // Miscellaneous else if (!strcmp(WeaponName, "Grenade", true && PlayerInfo[playerid][pRank] >=3) { GivePlayerWeapon(playerid,16,2); // grenade } else if (!strcmp(WeaponName, "Tear Gas", true && PlayerInfo[playerid][pRank] >=6) { GivePlayerWeapon(playerid,17,2); // tear gas } else if (!strcmp(WeaponName, "Molotov Cocktail", true && PlayerInfo[playerid][pRank] >=9) { GivePlayerWeapon(playerid,18,2); // molotov cocktail } return 1; }
[22:06:07] <Slice> well for one you started with "else if" [22:06:10] <Slice> else than WHAT? [22:06:19] <Slice> else if (!strcmp(WeaponName, "9mm", true && PlayerInfo[playerid][pRank] >=1) // Rank 1+ [22:06:25] <Slice> true && PlayerInfo[playerid][pRank] >=1 [22:06:30] <Slice> what do you think that means? [22:06:38] <Slice> and when you open something, close it [22:06:39] <Slice> ( [22:06:40] <Slice> ends with ) [22:06:42] <Slice> always [22:06:50] <Slice> as you can see there are 2 ( and 1 ) |
Can someone help me sort this out so i can do
GiveWeaponToPlayer(playerid,"9mm") or something like this? Please help im actually begging! + Rep Код:
stock GiveWeaponToPlayer(playerid,WeaponName[]) { // Pistols else if (!strcmp(WeaponName, "9mm", true && PlayerInfo[playerid][pRank] >=1)) // Rank 1+ { GivePlayerWeapon(playerid,22,20); //9mm } else if (!strcmp(WeaponName, "Silenced 9mm", true && PlayerInfo[playerid][pRank] >=5) { GivePlayerWeapon(playerid,23,20); // Silenced 9mm } else if (!strcmp(WeaponName, "Deagle", true && PlayerInfo[playerid][pRank] >=5) { GivePlayerWeapon(playerid,24,20); // Deagle } //Automatics else if (!strcmp(WeaponName, "Micro SMG", true && PlayerInfo[playerid][pRank] >=7) { GivePlayerWeapon(playerid,28,100); // Micro SMG } else if (!strcmp(WeaponName, "Tec 9", true && PlayerInfo[playerid][pRank] >=18) { GivePlayerWeapon(playerid,32,100); // tec9 } else if (!strcmp(WeaponName, "mp5", true && PlayerInfo[playerid][pRank] >=29) { GivePlayerWeapon(playerid,29,100); // mp5 } else if (!strcmp(WeaponName, "ak47", true && PlayerInfo[playerid][pRank] >=35) { GivePlayerWeapon(playerid,30,100); // ak47 } else if (!strcmp(WeaponName, "m4", true && PlayerInfo[playerid][pRank] >=42) { GivePlayerWeapon(playerid,31,100); // m4 } //Shotguns else if (!strcmp(WeaponName, "Barrel Shotgun", true && PlayerInfo[playerid][pRank] >=7) { GivePlayerWeapon(playerid,25,30); //barrel shotgun } else if (!strcmp(WeaponName, "Combat Shotgun", true && PlayerInfo[playerid][pRank] >=19) { GivePlayerWeapon(playerid,27,30); // combat shotgun } else if (!strcmp(WeaponName, "Sawnoff Shotgun", true && PlayerInfo[playerid][pRank] >=32) { GivePlayerWeapon(playerid,26,30); // sawnoff } //Rifles else if (!strcmp(WeaponName, "Country Rifle", true && PlayerInfo[playerid][pRank] >=9) { GivePlayerWeapon(playerid,33,30); // country rifle } else if (!strcmp(WeaponName, "Sniper Rifle", true && PlayerInfo[playerid][pRank] >=12) { GivePlayerWeapon(playerid,34,30); // sniper rifle } // Heavy Duty else if (!strcmp(WeaponName, "Flamethrower", true && PlayerInfo[playerid][pRank] >=19) { GivePlayerWeapon(playerid,37,15); // flamethrower } else if (!strcmp(WeaponName, "RPG", true && PlayerInfo[playerid][pRank] >=26) { GivePlayerWeapon(playerid,35,2); // rpg } // Miscellaneous else if (!strcmp(WeaponName, "Grenade", true && PlayerInfo[playerid][pRank] >=3) { GivePlayerWeapon(playerid,16,2); // grenade } else if (!strcmp(WeaponName, "Tear Gas", true && PlayerInfo[playerid][pRank] >=6) { GivePlayerWeapon(playerid,17,2); // tear gas } else if (!strcmp(WeaponName, "Molotov Cocktail", true && PlayerInfo[playerid][pRank] >=9) { GivePlayerWeapon(playerid,18,2); // molotov cocktail } return 1; } |
stock GiveWeaponToPlayer(playerid,WeaponName[])
{
// Pistols
else if (!strcmp(WeaponName == "9mm") && PlayerInfo[playerid][pRank] >=1) // Rank 1+
{
GivePlayerWeapon(playerid,22,20); //9mm
}
else if (!strcmp(WeaponName == "Silenced 9mm") && PlayerInfo[playerid][pRank] >=5)
{
GivePlayerWeapon(playerid,23,20); // Silenced 9mm
}
else if (!strcmp(WeaponName == "Deagle") && PlayerInfo[playerid][pRank] >=5)
{
GivePlayerWeapon(playerid,24,20); // Deagle
}
//Automatics
else if (!strcmp(WeaponName == "Micro SMG") && PlayerInfo[playerid][pRank] >=7)
{
GivePlayerWeapon(playerid,28,100); // Micro SMG
}
else if (!strcmp(WeaponName == "Tec 9") && PlayerInfo[playerid][pRank] >=18)
{
GivePlayerWeapon(playerid,32,100); // tec9
}
else if (!strcmp(WeaponName == "mp5") && PlayerInfo[playerid][pRank] >=29)
{
GivePlayerWeapon(playerid,29,100); // mp5
}
else if (!strcmp(WeaponName == "ak47") && PlayerInfo[playerid][pRank] >=35)
{
GivePlayerWeapon(playerid,30,100); // ak47
}
else if (!strcmp(WeaponName == "m4") && PlayerInfo[playerid][pRank] >=42)
{
GivePlayerWeapon(playerid,31,100); // m4
}
//Shotguns
else if (!strcmp(WeaponName == "Barrel Shotgun") && PlayerInfo[playerid][pRank] >=7)
{
GivePlayerWeapon(playerid,25,30); //barrel shotgun
}
else if (!strcmp(WeaponName == "Combat Shotgun") && PlayerInfo[playerid][pRank] >=19)
{
GivePlayerWeapon(playerid,27,30); // combat shotgun
}
else if (!strcmp(WeaponName == "Sawnoff Shotgun") && PlayerInfo[playerid][pRank] >=32)
{
GivePlayerWeapon(playerid,26,30); // sawnoff
}
//Rifles
else if (!strcmp(WeaponName == "Country Rifle") && PlayerInfo[playerid][pRank] >=9)
{
GivePlayerWeapon(playerid,33,30); // country rifle
}
else if (!strcmp(WeaponName == "Sniper Rifle") && PlayerInfo[playerid][pRank] >=12)
{
GivePlayerWeapon(playerid,34,30); // sniper rifle
}
// Heavy Duty
else if (!strcmp(WeaponName == "Flamethrower") && PlayerInfo[playerid][pRank] >=19)
{
GivePlayerWeapon(playerid,37,15); // flamethrower
}
else if (!strcmp(WeaponName == "RPG") && PlayerInfo[playerid][pRank] >=26)
{
GivePlayerWeapon(playerid,35,2); // rpg
}
// Miscellaneous
else if (!strcmp(WeaponName == "Grenade") && PlayerInfo[playerid][pRank] >=3)
{
GivePlayerWeapon(playerid,16,2); // grenade
}
else if (!strcmp(WeaponName == "Tear Gas") && PlayerInfo[playerid][pRank] >=6)
{
GivePlayerWeapon(playerid,17,2); // tear gas
}
else if (!strcmp(WeaponName == "Molotov Cocktail") && PlayerInfo[playerid][pRank] >=9)
{
GivePlayerWeapon(playerid,18,2); // molotov cocktail
}
return 1;
}
case 0: { //9mm Rank 1+ GiveWeaponToPlayer(playerid,9mm); }