This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

Problem with cycle for in my plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
BAILANDO
Senior Member
Join Date: Feb 2015
Location: Slovakia
Old 03-06-2015 , 13:55   Problem with cycle for in my plugin
Reply With Quote #1

Hello, i making a plugin for my members on Gaming Portal but i have one small problem, if i select player from menu to gag, then plugin gag one player which i select and one player another, still same player and i dont select this player to gag. Here is example of my code from PawnStudio, thanks for help.


public MenuCallBack(Handle:menupo, MenuAction:action, client, Position){
if(action == MenuAction_Select){
new String:item[32];
GetMenuItem(menupo, Position, item, sizeof(item));
if(StrEqual(item, "ungagmenu")){
new String:meno[MAX_NAME_LENGTH];
new Handle:menupoungag = CreateMenu(MenuCallBackUngag);
SetMenuTitle(menupoungag, "[SM] Podpora UnGag Menu - URNA.po");
for(new i = 1; i <= GetMaxClients(); i++){
if(IsClientInGame(i)){
GetClientName(i, meno, sizeof(meno));
AddMenuItem(menupoungag, meno, meno);
}
}
SetMenuPagination(menupoungag, ;
SetMenuExitButton(menupoungag, true);
DisplayMenu(menupoungag, client, MENU_TIME_FOREVER);
}
else if(StrEqual(item, "gagmenu")){
new String:meno[MAX_NAME_LENGTH];
new Handle:menupogag = CreateMenu(MenuCallBackGag);
SetMenuTitle(menupogag, "[SM] Podpora Gag Menu - URNA.po");
for(new i = 1; i <= GetMaxClients(); i++){
if(IsClientInGame(i)){
GetClientName(i, meno, sizeof(meno));
AddMenuItem(menupogag, meno, meno);
}
}
SetMenuPagination(menupogag, ;
SetMenuExitButton(menupogag, true);
DisplayMenu(menupogag, client, MENU_TIME_FOREVER);
}
}
}

public MenuCallBackGag(Handle:menupogag, MenuAction:action, client, Position){
new String:item[32];
new String:loopmeno[MAX_NAME_LENGTH];
GetMenuItem(menupogag, Position, item, sizeof(item));
for(new i = 1; i <= GetMaxClients(); i++){
if(IsClientInGame(i)){
GetClientName(i, loopmeno, sizeof(loopmeno));
if(StrEqual(loopmeno, item, true) && IsClientInGame(i)){
ServerCommand("sm_gag \"%s\"", loopmeno);
}
}
}
}

public MenuCallBackUngag(Handle:menupoungag, MenuAction:action, client, Position){
new String:item[32];
new String:loopmeno[MAX_NAME_LENGTH];
GetMenuItem(menupoungag, Position, item, sizeof(item));
for(new i = 1; i <= GetMaxClients(); i++){
if(IsClientInGame(i)){
GetClientName(i, loopmeno, sizeof(loopmeno));
if(StrEqual(loopmeno, item, true) && IsClientInGame(i)){
ServerCommand("sm_ungag \"%s\"", loopmeno);
}
}
}
}

Last edited by BAILANDO; 03-06-2015 at 14:11.
BAILANDO is offline
Brrdy
Senior Member
Join Date: Feb 2015
Old 03-06-2015 , 14:07   Re: Problem with cycle for in my plugin
Reply With Quote #2

Oh god the indenting x.x
Brrdy is offline
BAILANDO
Senior Member
Join Date: Feb 2015
Location: Slovakia
Old 03-06-2015 , 14:14   Re: Problem with cycle for in my plugin
Reply With Quote #3

I got normal indenting, but here is broken now for me maybe.

http://ctrlv.cz/6U4h
http://ctrlv.cz/81xR
BAILANDO is offline
BAILANDO
Senior Member
Join Date: Feb 2015
Location: Slovakia
Old 03-06-2015 , 14:18   Re: Problem with cycle for in my plugin
Reply With Quote #4

Here is example from server, i select player Kriskoo and plugin gag two players:

http://ctrlv.cz/CQBM
http://ctrlv.cz/sQe5
BAILANDO is offline
BAILANDO
Senior Member
Join Date: Feb 2015
Location: Slovakia
Old 03-06-2015 , 14:24   Re: Problem with cycle for in my plugin
Reply With Quote #5

Problem found, i forgot to add action == menuaction_select on top of menucallback handler.
BAILANDO is offline
Brrdy
Senior Member
Join Date: Feb 2015
Old 03-06-2015 , 14:47   Re: Problem with cycle for in my plugin
Reply With Quote #6

Quote:
Originally Posted by BAILANDO View Post
Problem found, i forgot to add action == menuaction_select on top of menucallback handler.
Yep I see Also I'd stay away from out-site linking Just use code tags
Brrdy is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 19:53.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode