Thread: Objectives
View Single Post
Brad
AMX Mod X Team Member
Join Date: Jun 2004
Old 12-14-2005 , 15:30  
Reply With Quote #4

Good concept. Issues with the coding.

The for loop is wrong in this code:
Code:
public NewRound() {     new players[32], num, i     get_players(players, num, "ac")     for(i = 0; i <= num; i++)     {         showobjectives(players[i])     } }
Change the 'for' line to this:
Code:
for(i = 0; i < num; i++)
There's no need to use cs_get_user_team and I'm pretty sure that as a rule, you shouldn't. Instead just use get_user_team. As a bonus, you no longer have to include cstrike.

Finally, use if else instead of a bunch of if statements. You'll be able to reduce the duplication of return PLUGIN_HANDLED all over the place. For that matter, get rid of return PLUGIN_HANDLED altogether as you're not using the return value for anything and show_objectives isn't a forward.

Edit: You might also want to handle the case where maps include more than one objective.

Edit2: Make it multilingual while you're at it. There's a huge segment of AMXX servers out there whose primary language isn't English.
Brad is offline