Hi, I'm trying to allow players to do !invite <playername>, but using ProcessTargetString does not seem to work properly for non-admins..?
My code:
PHP Code:
char target_name[MAX_TARGET_LENGTH];
int target_list[MAXPLAYERS], target_count;
bool tn_is_ml;
if((target_count = ProcessTargetString(arg, client, target_list, MAXPLAYERS, COMMAND_FILTER_NO_BOTS|COMMAND_FILTER_NO_MULTI, target_name, sizeof(target_name), tn_is_ml)) <= 0) {
ReplyToTargetError(client, target_count);
return false;
}
for(int usr = 0; usr < target_count; usr++) { // target_list[usr] is now the target entity index
if(!IsValidClient(target_list[usr], _, true))
continue;
if(target_list[usr] == client) { // Make sure target is not the client
// Cannot invite yourself
break;
}
CPrintToChat(client, "Invite sent to %N !", target_list[usr]);
}
But it doesn't seem to work properly..
If I try to target anyone I get:
[SM] You cannot target this player.
Is there another way to do this, allowing players without flags to use it?
__________________