Hi, I'm trying to write my first plugin but I have a problem and couldn't figure it out.
I want to create a main menu and a submenu in my plugin. In this submenu, I would like to list the contacts on the server and make the selection. I couldn't figure it out because the selected user had to switch teams.
The plug-in turns seamlessly into the smx file, but when I load it on the server it gives an error when using the command and the panel doesn't open
PHP Code:
new Handle:submenu = CreateMenu(HDTMenuTakim);
SetMenuTitle(submenu, "TAKIM DEGIS");
for(new i = 1; i <= MaxClients; i++){
decl String:TargetName[512];
GetClientName(i, TargetName, sizeof(TargetName));
AddMenuItem(submenu, TargetName, TargetName);
}
SetMenuExitButton(submenu, true);
DisplayMenu(submenu, client, MENU_TIME_FOREVER);
------------------------------------------
new target = -1;
new String:info[512];
GetMenuItem(menu, TargetUser, info, sizeof(info));
for(new i = 1; i <= MaxClients; i++){
if(!IsClientInGame(i)){
continue;
}
decl String:other[512];
GetClientName(i, other, sizeof(other));
if(StrEqual(info, other)){
target = i;
}
}
if(GetClientTeam(target) != 2){
ChangeClientTeam(target, 2);
}else if(GetClientTeam(target) != 3){
ChangeClientTeam(target, 3);
}