28.07.2014, 03:36
Hello, I need help getting some array values to make my code smaller. Here's what I mean:
This is my code
I want to use something like
I've already tried
But it won't work because the values can only be used inside the for function and I need to use them in the if function.
And I've also tried
But it doesn't work.
Any help? Thanks in advance.
This is my code
Код:
if(issuerid != INVALID_PLAYER_ID && weaponid == 34 && bodypart == 9) { SetPlayerHealth(playerid, 0.0); } if(issuerid != INVALID_PLAYER_ID && weaponid == 25 && bodypart == 9) { SetPlayerHealth(playerid, 0.0); } if(issuerid != INVALID_PLAYER_ID && weaponid == 27 && bodypart == 9) { SetPlayerHealth(playerid, 0.0); } if(issuerid != INVALID_PLAYER_ID && weaponid == 26 && bodypart == 9) { SetPlayerHealth(playerid, 0.0); } if(issuerid != INVALID_PLAYER_ID && weaponid == 30 && bodypart == 9) { SetPlayerHealth(playerid, 0.0); } if(issuerid != INVALID_PLAYER_ID && weaponid == 31 && bodypart == 9) { SetPlayerHealth(playerid, 0.0); } if(issuerid != INVALID_PLAYER_ID && weaponid == 24 && bodypart == 9) { SetPlayerHealth(playerid, 0.0); }
Код:
new array[x] = {24,25,34,etc,etc...} if(issuerid != INVALID_PLAYER_ID && weaponid == arrayvalues && bodypart == 9) { }
Код:
new array[7]; array = {24, 25, 26, 27, 30, 31, 34}; new i; for (i=0; i<7; i++) { } if(issuerid != INVALID_PLAYER_ID && weaponid == array[i] && bodypart == 9) { SetPlayerHealth(playerid, 0.0); }
And I've also tried
Код:
if(issuerid != INVALID_PLAYER_ID && weaponid == 31 || 30 || 24 || 34 && bodypart == 9) { SetPlayerHealth(playerid, 0); }
Any help? Thanks in advance.