Raised This Month: $12 Target: $400
 3% 

take the clientid from the menu


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
TRServer
Junior Member
Join Date: Dec 2017
Old 12-15-2017 , 10:24   take the clientid from the menu
Reply With Quote #1

Hello

Code:
#include <sourcemod>
#include <sdktools>
#include <cstrike>

int 
	secenek1[MAXPLAYERS+1],
	secenek2[MAXPLAYERS+1],
	secenek3[MAXPLAYERS+1];


public OnPluginStart()
{
	RegConsoleCmd("sm_deneme", deneme);
	HookEvent("round_start", ElBasi);
	HookEvent("round_end", ElSonu);
}

public Action:deneme(int client, int args) {
	if(!client) return Plugin_Handled;

	Handle menu = CreateMenu(amain);
	SetMenuTitle(menu, "3 Seçenek Seç");
	decl String:opcionmenu[124];
	Format(opcionmenu, 124, "Seçenek 1");
	AddMenuItem(menu, "0", opcionmenu);
	Format(opcionmenu, 124, "Seçenek 2");
	AddMenuItem(menu, "1", opcionmenu);
	Format(opcionmenu, 124, "Seçenek 3");
	AddMenuItem(menu, "2", opcionmenu);
	SetMenuExitBackButton(menu, false);
	DisplayMenu(menu, client, MENU_TIME_FOREVER);

	return Plugin_Handled;
}
public void ElBasi(Event event, const char[] name, bool dontBroadcast) {

	for (int i = 1; i <= MaxClients; i++) {
		if(i && IsClientInGame(i) && IsClientConnected(i) && !IsFakeClient(i))   {
		secenek1[i] = secenek2[i] = secenek3[i] = false;
		}
	}
}

public void ElSonu(Event event, const char[] name, bool dontBroadcast) {

	int client = event.GetInt("userid");
	if (secenek1[client])PrintToChat(client, "Seçtiğin Seçenek 1'di.");
	if (secenek2[client])PrintToChat(client, "Seçtiğin Seçenek 2'ydi.");
	if (secenek3[client])PrintToChat(client, "Seçtiğin Seçenek 3'tü.");
}

public amain(Handle:menu, MenuAction:action, client, itemNum) {
	if(action == MenuAction_Select) {
		switch(itemNum) {
			case 0:	{ secenek1[client] 	= true;	}
			case 1:	{ secenek2[client]	= true; }
			case 2:	{ secenek3[client] 	= true; }
		}
	}

}
round_end it doesn't say this is the option I chose

I'm sorry my English is not good

Last edited by TRServer; 12-15-2017 at 10:28. Reason: compiled error fix
TRServer is offline
hmmmmm
Great Tester of Whatever
Join Date: Mar 2017
Location: ...
Old 12-15-2017 , 12:19   Re: take the clientid from the menu
Reply With Quote #2

Should be:
int client = GetClientOfUserId(event.GetInt("userid"));
hmmmmm is offline
TRServer
Junior Member
Join Date: Dec 2017
Old 12-15-2017 , 12:47   Re: take the clientid from the menu
Reply With Quote #3

I tired, no way
TRServer is offline
Peace-Maker
SourceMod Plugin Approver
Join Date: Aug 2008
Location: Germany
Old 12-16-2017 , 09:59   Re: take the clientid from the menu
Reply With Quote #4

round_end doesn't have a "userid" field. You want to loop through all clients like you do in your round_start handler.
__________________
Peace-Maker is offline
Reply


Thread Tools
Display Modes

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 12:32.


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