AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   take the clientid from the menu (https://forums.alliedmods.net/showthread.php?t=303626)

TRServer 12-15-2017 10:24

take the clientid from the menu
 
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

hmmmmm 12-15-2017 12:19

Re: take the clientid from the menu
 
Should be:
int client = GetClientOfUserId(event.GetInt("userid"));

TRServer 12-15-2017 12:47

Re: take the clientid from the menu
 
I tired, no way

Peace-Maker 12-16-2017 09:59

Re: take the clientid from the menu
 
round_end doesn't have a "userid" field. You want to loop through all clients like you do in your round_start handler.


All times are GMT -4. The time now is 11:41.

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