new Float: health; new Float: armour; GetPlayerHealth(playerid, health); GetPlayerArmour(playerid, armour); if(issuerid != INVALID_PLAYER_ID) { if(weaponid == 0) { switch(armour) { case 0: { switch(bodypart) { case 3: SetPlayerHealth(playerid, health - 5); // Torso. case 4: SetPlayerHealth(playerid, health - 5); // Groin. case 5: SetPlayerHealth(playerid, health - 5); // Left Arm. case 6: SetPlayerHealth(playerid, health - 5); // Right Arm. case 7: SetPlayerHealth(playerid, health - 5); // Left Leg. case 8: SetPlayerHealth(playerid, health - 5); // Right Leg. case 9: SetPlayerHealth(playerid, health - 5); // Head. } } default: { switch(bodypart) { case 3: SetPlayerHealth(playerid, health - 5); // Torso. case 4: SetPlayerHealth(playerid, health - 5); // Groin. case 5: SetPlayerHealth(playerid, health - 5); // Left Arm. case 6: SetPlayerHealth(playerid, health - 5); // Right Arm. case 7: SetPlayerHealth(playerid, health - 5); // Left Leg. case 8: SetPlayerHealth(playerid, health - 5); // Right Leg. case 9: SetPlayerHealth(playerid, health - 5); // Head. } } } } else if(weaponid == 3) { switch(armour) { case 0: { switch(bodypart) { case 3: SetPlayerHealth(playerid, health - 8); // Torso. case 4: SetPlayerHealth(playerid, health - 8); // Groin. case 5: SetPlayerHealth(playerid, health - 8); // Left Arm. case 6: SetPlayerHealth(playerid, health - 8); // Right Arm. case 7: SetPlayerHealth(playerid, health - 8); // Left Leg. case 8: SetPlayerHealth(playerid, health - 8); // Right Leg. case 9: SetPlayerHealth(playerid, health - 8); // Head. } } default: { switch(bodypart) { case 3: SetPlayerArmour(playerid, armour - 8); // Torso. case 4: SetPlayerArmour(playerid, armour - 8); // Groin. case 5: SetPlayerArmour(playerid, armour - 8); // Left Arm. case 6: SetPlayerArmour(playerid, armour - 8); // Right Arm. case 7: SetPlayerArmour(playerid, armour - 8); // Left Leg. case 8: SetPlayerArmour(playerid, armour - 8); // Right Leg. case 9: SetPlayerArmour(playerid, armour - 8); // Head. } } } } else if(weaponid == 4) { switch(armour) { case 0: { switch(bodypart) { case 3: SetPlayerHealth(playerid, health - 11); // Torso. case 4: SetPlayerHealth(playerid, health - 11); // Groin. case 5: SetPlayerHealth(playerid, health - 11); // Left Arm. case 6: SetPlayerHealth(playerid, health - 11); // Right Arm. case 7: SetPlayerHealth(playerid, health - 11); // Left Leg. case 8: SetPlayerHealth(playerid, health - 11); // Right Leg. case 9: SetPlayerHealth(playerid, health - 11); // Head. } } default: { switch(bodypart) { case 3: SetPlayerHealth(playerid, health - 11); // Torso. case 4: SetPlayerHealth(playerid, health - 11); // Groin. case 5: SetPlayerHealth(playerid, health - 11); // Left Arm. case 6: SetPlayerHealth(playerid, health - 11); // Right Arm. case 7: SetPlayerHealth(playerid, health - 11); // Left Leg. case 8: SetPlayerHealth(playerid, health - 11); // Right Leg. case 9: SetPlayerHealth(playerid, health - 11); // Head. } } } } else if(weaponid == 5) { switch(armour) { case 0: { switch(bodypart) { case 3: SetPlayerHealth(playerid, health - 11); // Torso. case 4: SetPlayerHealth(playerid, health - 11); // Groin. case 5: SetPlayerHealth(playerid, health - 11); // Left Arm. case 6: SetPlayerHealth(playerid, health - 11); // Right Arm. case 7: SetPlayerHealth(playerid, health - 11); // Left Leg. case 8: SetPlayerHealth(playerid, health - 11); // Right Leg. case 9: SetPlayerHealth(playerid, health - 11); // Head. } } default: { switch(bodypart) { case 3: SetPlayerHealth(playerid, health - 11); // Torso. case 4: SetPlayerHealth(playerid, health - 11); // Groin. case 5: SetPlayerHealth(playerid, health - 11); // Left Arm. case 6: SetPlayerHealth(playerid, health - 11); // Right Arm. case 7: SetPlayerHealth(playerid, health - 11); // Left Leg. case 8: SetPlayerHealth(playerid, health - 11); // Right Leg. case 9: SetPlayerHealth(playerid, health - 11); // Head. } } } } else if(weaponid == 8) { switch(armour) { if(armour <= 0) { case 0: { switch(bodypart) { case 3: SetPlayerHealth(playerid, health - 13); // Torso. case 4: SetPlayerHealth(playerid, health - 13); // Groin. case 5: SetPlayerHealth(playerid, health - 13); // Left Arm. case 6: SetPlayerHealth(playerid, health - 13); // Right Arm. case 7: SetPlayerHealth(playerid, health - 13); // Left Leg. case 8: SetPlayerHealth(playerid, health - 13); // Right Leg. case 9: SetPlayerHealth(playerid, health - 99); // Head. } } } else if(armor >=1) { default: { switch(bodypart) { case 3: SetPlayerHealth(playerid, health - 13); // Torso. case 4: SetPlayerHealth(playerid, health - 13); // Groin. case 5: SetPlayerHealth(playerid, health - 13); // Left Arm. case 6: SetPlayerHealth(playerid, health - 13); // Right Arm. case 7: SetPlayerHealth(playerid, health - 13); // Left Leg. case 8: SetPlayerHealth(playerid, health - 13); // Right Leg. case 9: SetPlayerHealth(playerid, health - 99); // Head. } } } } } else if(weaponid == 22) { switch(armour) { if(armour <= 0) { case 0: { switch(bodypart) { case 3: SetPlayerHealth(playerid, health - 15); // Torso. case 4: SetPlayerHealth(playerid, health - 15); // Groin. case 5: SetPlayerHealth(playerid, health - 15); // Left Arm. case 6: SetPlayerHealth(playerid, health - 15); // Right Arm. case 7: SetPlayerHealth(playerid, health - 15); // Left Leg. case 8: SetPlayerHealth(playerid, health - 15); // Right Leg. case 9: SetPlayerHealth(playerid, health - 45); // Head. } } else if(armor >=1) { default: { switch(bodypart) { case 3: SetPlayerHealth(playerid, health - 11); // Torso. case 4: SetPlayerHealth(playerid, health - 11); // Groin. case 5: SetPlayerHealth(playerid, health - 11); // Left Arm. case 6: SetPlayerHealth(playerid, health - 11); // Right Arm. case 7: SetPlayerHealth(playerid, health - 11); // Left Leg. case 8: SetPlayerHealth(playerid, health - 11); // Right Leg. case 9: SetPlayerHealth(playerid, health - 45); // Head. } } } } } else if(weaponid == 23) { switch(armour) { if(armour <= 0) { case 0: { switch(bodypart) { case 3: SetPlayerHealth(playerid, health - 11); // Torso. case 4: SetPlayerHealth(playerid, health - 11); // Groin. case 5: SetPlayerHealth(playerid, health - 11); // Left Arm. case 6: SetPlayerHealth(playerid, health - 11); // Right Arm. case 7: SetPlayerHealth(playerid, health - 11); // Left Leg. case 8: SetPlayerHealth(playerid, health - 11); // Right Leg. case 9: SetPlayerHealth(playerid, health - 45); // Head. } } else if(armor >=1) { default: { switch(bodypart) { case 3: SetPlayerHealth(playerid, health - 11); // Torso. case 4: SetPlayerHealth(playerid, health - 11); // Groin. case 5: SetPlayerHealth(playerid, health - 11); // Left Arm. case 6: SetPlayerHealth(playerid, health - 11); // Right Arm. case 7: SetPlayerHealth(playerid, health - 11); // Left Leg. case 8: SetPlayerHealth(playerid, health - 11); // Right Leg. case 9: SetPlayerHealth(playerid, health - 45); // Head. } } } } } else if(weaponid == 22) { switch(armour) { if(armour <= 0) { case 0: { switch(bodypart) { case 3: SetPlayerHealth(playerid, health - 25); // Torso. case 4: SetPlayerHealth(playerid, health - 20); // Groin. case 5: SetPlayerHealth(playerid, health - 10); // Left Arm. case 6: SetPlayerHealth(playerid, health - 10); // Right Arm. case 7: SetPlayerHealth(playerid, health - 10); // Left Leg. case 8: SetPlayerHealth(playerid, health - 10); // Right Leg. case 9: SetPlayerHealth(playerid, health - 50); // Head. } } else if(armor >=1) { default: { switch(bodypart) { case 3: SetPlayerArmour(playerid, armour - 13); // Torso. case 4: SetPlayerArmour(playerid, armour - 10); // Groin. case 5: SetPlayerArmour(playerid, armour - 5); // Left Arm. case 6: SetPlayerArmour(playerid, armour - 5); // Right Arm. case 7: SetPlayerArmour(playerid, armour - 5); // Left Leg. case 8: SetPlayerArmour(playerid, armour - 5); // Right Leg. case 9: SetPlayerArmour(playerid, armour - 25); // Head. } } } } } else if(weaponid == 24) { switch(armour) { if(armour <= 0) { case 0: { switch(bodypart) { case 3: SetPlayerHealth(playerid, health - 30); // Torso. case 4: SetPlayerHealth(playerid, health - 20); // Groin. case 5: SetPlayerHealth(playerid, health - 15); // Left Arm. case 6: SetPlayerHealth(playerid, health - 15); // Right Arm. case 7: SetPlayerHealth(playerid, health - 15); // Left Leg. case 8: SetPlayerHealth(playerid, health - 15); // Right Leg. case 9: SetPlayerHealth(playerid, health - 60); // Head. } } else if(armor >=1) { default: { switch(bodypart) { case 3: SetPlayerArmour(playerid, armour - 15); // Torso. case 4: SetPlayerArmour(playerid, armour - 10); // Groin. case 5: SetPlayerArmour(playerid, armour - 8); // Left Arm. case 6: SetPlayerArmour(playerid, armour - 8); // Right Arm. case 7: SetPlayerArmour(playerid, armour - 8); // Left Leg. case 8: SetPlayerArmour(playerid, armour - 8); // Right Leg. case 9: SetPlayerArmour(playerid, armour - 40); // Head. } } } } } else if(weaponid == 25) { switch(armour) { if(armour <= 0) { case 0: // If the value is 0, the codes underneath will activate. { switch(bodypart) { case 3: SetPlayerHealth(playerid, health - 40); // Torso. case 4: SetPlayerHealth(playerid, health - 20); // Groin. case 5: SetPlayerHealth(playerid, health - 15); // Left Arm. case 6: SetPlayerHealth(playerid, health - 15); // Right Arm. case 7: SetPlayerHealth(playerid, health - 15); // Left Leg. case 8: SetPlayerHealth(playerid, health - 15); // Right Leg. case 9: SetPlayerHealth(playerid, health - 100); // Head. } } } else if(armor >=1) { default: // Otherwise the codes underneath will activate. { switch(bodypart) { case 3: SetPlayerArmour(playerid, armour - 20); // Torso. case 4: SetPlayerArmour(playerid, armour - 10); // Groin. case 5: SetPlayerArmour(playerid, armour - 7); // Left Arm. case 6: SetPlayerArmour(playerid, armour - 7); // Right Arm. case 7: SetPlayerArmour(playerid, armour - 7); // Left Leg. case 8: SetPlayerArmour(playerid, armour - 7); // Right Leg. case 9: SetPlayerArmour(playerid, armour - 50); // Head. } } } } } else if(weaponid == 29) { switch(armour) { if(armour <= 0) { case 0: { switch(bodypart) { case 3: SetPlayerHealth(playerid, health - 15); // Torso. case 4: SetPlayerHealth(playerid, health - 10); // Groin. case 5: SetPlayerHealth(playerid, health - 10); // Left Arm. case 6: SetPlayerHealth(playerid, health - 10); // Right Arm. case 7: SetPlayerHealth(playerid, health - 10); // Left Leg. case 8: SetPlayerHealth(playerid, health - 10); // Right Leg. case 9: SetPlayerHealth(playerid, health - 50); // Head. } } else if(armor >=1) { default: { switch(bodypart) { case 3: SetPlayerArmour(playerid, armour - 10); // Torso. case 4: SetPlayerArmour(playerid, armour - 10); // Groin. case 5: SetPlayerArmour(playerid, armour - 5); // Left Arm. case 6: SetPlayerArmour(playerid, armour - 5); // Right Arm. case 7: SetPlayerArmour(playerid, armour - 5); // Left Leg. case 8: SetPlayerArmour(playerid, armour - 5); // Right Leg. case 9: SetPlayerArmour(playerid, armour - 25); // Head. } } } } } else if(weaponid == 30) { switch(armour) { if(armour <= 0) { case 0: // If the value is 0, the codes underneath will activate. { switch(bodypart) { case 3: SetPlayerHealth(playerid, health - 35); // Torso. case 4: SetPlayerHealth(playerid, health - 35); // Groin. case 5: SetPlayerHealth(playerid, health - 20); // Left Arm. case 6: SetPlayerHealth(playerid, health - 20); // Right Arm. case 7: SetPlayerHealth(playerid, health - 14); // Left Leg. case 8: SetPlayerHealth(playerid, health - 14); // Right Leg. case 9: SetPlayerHealth(playerid, health - 50); // Head. } } else if(armor >=1) { default: // Otherwise the codes underneath will activate. { switch(bodypart) { case 3: SetPlayerArmour(playerid, armour - 15); // Torso. case 4: SetPlayerArmour(playerid, armour - 15); // Groin. case 5: SetPlayerArmour(playerid, armour - 10); // Left Arm. case 6: SetPlayerArmour(playerid, armour - 10); // Right Arm. case 7: SetPlayerArmour(playerid, armour - 7); // Left Leg. case 8: SetPlayerArmour(playerid, armour - 7); // Right Leg. case 9: SetPlayerArmour(playerid, armour - 50); // Head. } } } } } else if(weaponid == 31) { switch(armour) { if(armour <= 0) { case 0: // If the value is 0, the codes underneath will activate. { switch(bodypart) { case 3: SetPlayerHealth(playerid, health - 20); // Torso. case 4: SetPlayerHealth(playerid, health - 20); // Groin. case 5: SetPlayerHealth(playerid, health - 10); // Left Arm. case 6: SetPlayerHealth(playerid, health - 10); // Right Arm. case 7: SetPlayerHealth(playerid, health - 7); // Left Leg. case 8: SetPlayerHealth(playerid, health - 7); // Right Leg. case 9: SetPlayerHealth(playerid, health - 100); // Head. } } else if(armor >=1) { default: // Otherwise the codes underneath will activate. { switch(bodypart) { case 3: SetPlayerArmour(playerid, armour - 10); // Torso. case 4: SetPlayerArmour(playerid, armour - 10); // Groin. case 5: SetPlayerArmour(playerid, armour - 5); // Left Arm. case 6: SetPlayerArmour(playerid, armour - 4); // Right Arm. case 7: SetPlayerArmour(playerid, armour - 4); // Left Leg. case 8: SetPlayerArmour(playerid, armour - 4); // Right Leg. case 9: SetPlayerArmour(playerid, armour - 50); // Head. } } } } } else if(weaponid == 32) { switch(armour) { if(armour <= 0) { case 0: { switch(bodypart) { case 3: SetPlayerHealth(playerid, health - 15); // Torso. case 4: SetPlayerHealth(playerid, health - 15); // Groin. case 5: SetPlayerHealth(playerid, health - 15); // Left Arm. case 6: SetPlayerHealth(playerid, health - 15); // Right Arm. case 7: SetPlayerHealth(playerid, health - 15); // Left Leg. case 8: SetPlayerHealth(playerid, health - 15); // Right Leg. case 9: SetPlayerHealth(playerid, health - 50); // Head. } } else if(armor >=1) { default: { switch(bodypart) { case 3: SetPlayerArmour(playerid, armour - 10); // Torso. case 4: SetPlayerArmour(playerid, armour - 10); // Groin. case 5: SetPlayerArmour(playerid, armour - 10); // Left Arm. case 6: SetPlayerArmour(playerid, armour - 10); // Right Arm. case 7: SetPlayerArmour(playerid, armour - 10); // Left Leg. case 8: SetPlayerArmour(playerid, armour - 10); // Right Leg. case 9: SetPlayerArmour(playerid, armour - 25); // Head. } } } } } else if(weaponid == 33) { switch(armour) { if(armour <= 0) { case 0: { switch(bodypart) { case 3: SetPlayerHealth(playerid, health - 40); // Torso. case 4: SetPlayerHealth(playerid, health - 25); // Groin. case 5: SetPlayerHealth(playerid, health - 15); // Left Arm. case 6: SetPlayerHealth(playerid, health - 15); // Right Arm. case 7: SetPlayerHealth(playerid, health - 15); // Left Leg. case 8: SetPlayerHealth(playerid, health - 15); // Right Leg. case 9: SetPlayerHealth(playerid, health - 100); // Head. } } else if(armor >=1) { default: { switch(bodypart) { case 3: SetPlayerArmour(playerid, armour - 25); // Torso. case 4: SetPlayerArmour(playerid, armour - 15); // Groin. case 5: SetPlayerArmour(playerid, armour - 5); // Left Arm. case 6: SetPlayerArmour(playerid, armour - 5); // Right Arm. case 7: SetPlayerArmour(playerid, armour - 5); // Left Leg. case 8: SetPlayerArmour(playerid, armour - 5); // Right Leg. case 9: SetPlayerArmour(playerid, armour - 70); // Head. } } } } } else if(weaponid == 34) { switch(armour) { if(armour <= 0) { case 0: // If the value is 0, the codes underneath will activate. { switch(bodypart) { case 3: SetPlayerHealth(playerid, health - 60); // Torso. case 4: SetPlayerHealth(playerid, health - 35); // Groin. case 5: SetPlayerHealth(playerid, health - 20); // Left Arm. case 6: SetPlayerHealth(playerid, health - 20); // Right Arm. case 7: SetPlayerHealth(playerid, health - 20); // Left Leg. case 8: SetPlayerHealth(playerid, health - 20); // Right Leg. case 9: SetPlayerHealth(playerid, health - 100); // Head. } } else if(armor >=1) { default: // Otherwise the codes underneath will activate. { switch(bodypart) { case 3: SetPlayerArmour(playerid, armour - 25); // Torso. case 4: SetPlayerArmour(playerid, armour - 15); // Groin. case 5: SetPlayerArmour(playerid, armour - 5); // Left Arm. case 6: SetPlayerArmour(playerid, armour - 5); // Right Arm. case 7: SetPlayerArmour(playerid, armour - 5); // Left Leg. case 8: SetPlayerArmour(playerid, armour - 5); // Right Leg. case 9: SetPlayerArmour(playerid, armour - 70); // Head. } } } } } }
C:\Users\Disloyal\Desktop\GTA Related\Prospect\gamemodes\roleplay.pwn(17153) : error 002: only a single statement (or expression) can follow each "case" C:\Users\Disloyal\Desktop\GTA Related\Prospect\gamemodes\roleplay.pwn(17153 -- 17154) : error 028: invalid subscript (not an array or too many subscripts): "armour" C:\Users\Disloyal\Desktop\GTA Related\Prospect\gamemodes\roleplay.pwn(17153 -- 17155) : error 001: expected token: "}", but found "case" C:\Users\Disloyal\Desktop\GTA Related\Prospect\gamemodes\roleplay.pwn(17153 -- 17155) : fatal error 107: too many error messages on one line
switch(armour)
Can you explain to us (or yourself) what do you think this does?
Код:
switch(armour) |
switch(armour) { if(armour <= 0) { case 0:
If you do, then can you explain me what is the meaning of this?
Код:
switch(armour) { if(armour <= 0) { case 0: |
switch(armour) //Checks if player has armor. { if(armour <= 0) //Checks if player's armor is 0 or less than that. { case 0: //When Armor is 0, do whatever
if(armour <= 0) //Checks if player's armor is 0 or less than that. {
stock RemovePlayerHealth(playerid, Float:damage)
{
new Float:pHealth, Float:pArmour, Float:remArmour, Float:exArmour;
GetPlayerHealth(playerid, pHealth);
GetPlayerArmour(playerid, pArmour);
if(pArmour > 0)
{
if(damage > pArmour)
{
exArmour = damage - pArmour;
SetPlayerArmour(playerid, 0);
SetPlayerHealth(playerid, pHealth-exArmour);
}
else if(pArmour > damage)
{
remArmour = pArmour - damage;
SetPlayerArmour(playerid, remArmour)
}
}
}
It's contradicting itself, I know that. I don't know how to write it properly, that's why I came here for help.
ANYWAYS, what it does is this: Код:
switch(armour) //Checks if player has armor. { if(armour <= 0) //Checks if player's armor is 0 or less than that. { case 0: //When Armor is 0, do whatever Код:
if(armour <= 0) //Checks if player's armor is 0 or less than that. { |