20.06.2018, 03:20
It would work but it's not very well done.
For example, you repeatedly call GetPlayerWeapon (which always returns the same value) but you could store the value in a variable and then compare it (it's a bit more efficient, not that this would make any noticable difference, but still).
Something like this:
And then use weaponid instead of GetPlayerWeapon.
Furthermore you can use a switch statement for things like these:
Which makes it easier to code and to read.
You could also use the existing defines (like "WEAPON_MINIGUN") which is also easier to maintain because you will not have to look through Weapon IDs.
For example, you repeatedly call GetPlayerWeapon (which always returns the same value) but you could store the value in a variable and then compare it (it's a bit more efficient, not that this would make any noticable difference, but still).
Something like this:
Код:
new weaponid = GetPlayerWeapon(playerid);
Furthermore you can use a switch statement for things like these:
Код:
switch(weaponid) { case 16, 17, 35: // etc... You need to add the other IDs too { Kick(playerid); } }
You could also use the existing defines (like "WEAPON_MINIGUN") which is also easier to maintain because you will not have to look through Weapon IDs.