View Single Post
Author Message
BloodBullet
Junior Member
Join Date: May 2020
Old 05-22-2020 , 05:19   fatal error 186: insufficient memory
Reply With Quote #1

PHP Code:
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
#include <cstrike>
#include <captain>
#include <lastrequest>
#include <franug_jb>

new Handle:cvar_ff;

public 
OnPluginStart()
{
    
RegConsoleCmd("sm_menu"DOMenu);
    
RegConsoleCmd("buyammo2"DOMenu);
    
    
RegConsoleCmd("sm_simonmenu"DOsimon);
    
    
cvar_ff FindConVar("mp_teammates_are_enemies");
}


public 
Action:DOMenu(client,args)
{
    new 
Handle:menu CreateMenu(DIDMenuHandler);
    
SetMenuTitle(menu"");
    if(
"JC_GetCaptain"() == clientAddMenuItem(menu"simonmenu""Simon Menu");
    else if(
GetClientTeam(client) == CS_TEAM_CTAddMenuItem(menu"sersimon""Be Simon");
/*     if(GetClientTeam(client) == CS_TEAM_CT) AddMenuItem(menu, "tt", "Ser preso");
    else if(GetClientTeam(client) == CS_TEAM_T) AddMenuItem(menu, "ct", "Ser guardia (Micro requerido)"); */
    
    
if(GetClientTeam(client) == CS_TEAM_CTAddMenuItem(menu"guns""Choose weapons");
    
AddMenuItem(menu"tienda""Shop");
    
    
AddMenuItem(menu"hats""Hats Menu");
    
//AddMenuItem(menu, "normas", "Leer normas");
    //AddMenuItem(menu, "admin", "Menu de Administrador");
    
SetMenuExitButton(menutrue);
    
DisplayMenu(menuclientMENU_TIME_FOREVER);
}

public 
DIDMenuHandler(Handle:menuMenuAction:actionclientitemNum
{
    if ( 
action == MenuAction_Select 
    {
        new 
String:info[32];
        
        
GetMenuItem(menuitemNuminfosizeof(info));
        
/*         if ( strcmp(info,"tt") == 0 ) 
        {
            ClientCommand(client, "jointeam %i", CS_TEAM_T);
            DOMenu(client,0);
        }
        else if ( strcmp(info,"ct") == 0 ) 
        {
            ClientCommand(client, "jointeam %i", CS_TEAM_CT);
            DOMenu(client,0);
        } */
        
if ( strcmp(info,"guns") == 
        {
            
FakeClientCommand(client"say !guns");
        }
        else if ( 
strcmp(info,"tienda") == 
        {
            
FakeClientCommand(client"sm_awards");
        }
        else if ( 
strcmp(info,"hats") == 
        {
            
FakeClientCommand(client"sm_hats");
        }
        else if ( 
strcmp(info,"normas") == 
        {
            
FakeClientCommand(client"sm_rules");
            
//DOMenu(client,0);
        
}
        else if ( 
strcmp(info,"admin") == 
        {
            
FakeClientCommand(client"sm_admin");
        }
        else if ( 
strcmp(info,"simonmenu") == 
        {
            
FakeClientCommand(client"sm_simonmenu");
        }
        else if ( 
strcmp(info,"sersimon") == 
        {
            
DOMenu(client,0);
            
FakeClientCommand(client"sm_simon");

        }
        
    }
    else if (
action == MenuAction_End)
    {
        
CloseHandle(menu);
    }
}

public 
Action:DOsimon(client,args)
{
    new 
Handle:menu CreateMenu(DIDMenuHandlerS);
    
SetMenuTitle(menu"Simon menu");
    
    
AddMenuItem(menu"abrir""Open jail doors");
    
AddMenuItem(menu"cerrar""Close jail doors");
    
AddMenuItem(menu"fdall""Give FreeDay to all");
    
AddMenuItem(menu"fdone""Give FreeDay to a player");
    
AddMenuItem(menu"kill""Kill a random Ts");
    
    if(!
GetConVarBool(cvar_ff)) AddMenuItem(menu"ffa1""Enable friendly fire to Ts");
    else 
AddMenuItem(menu"ffa2""Disable friendly fire to Ts");
    
    
AddMenuItem(menu"nosimon""Leave Simon");
    
SetMenuExitButton(menutrue);
    
DisplayMenu(menuclientMENU_TIME_FOREVER);
}

public 
DIDMenuHandlerS(Handle:menuMenuAction:actionclientitemNum
{
    if ( 
action == MenuAction_Select 
    {
        if(
"JC_GetCaptain(") != client) return;
        
        new 
String:info[32];
        
        
GetMenuItem(menuitemNuminfosizeof(info));
        
        if ( 
strcmp(info,"abrir") == 
        {
            
FakeClientCommand(client"sm_open");
            
DOsimon(client,0);
        }
         else if ( 
strcmp(info,"cerrar") == 
        {
            
FakeClientCommand(client"sm_close");
            
DOsimon(client,0);
        } 
        else if ( 
strcmp(info,"fdall") == 
        {
            
FDTodos();
            
PrintToChatAll(" \x04[] \x05Simon given FreeDay to all!");
            
DOsimon(client,0);
        }
        else if ( 
strcmp(info,"fdone") == 
        {
            
FDone(client);
        }
        else if ( 
strcmp(info,"ffa1") == 
        {
            
SetCvar("mp_teammates_are_enemies"1);
            
PrintToChatAll(" \x04[] \x05Simon enabled the friendly fire to Ts!");
            
            
DOsimon(client,0);
        }
        else if ( 
strcmp(info,"ffa2") == 
        {
            
SetCvar("mp_teammates_are_enemies"0);
            
PrintToChatAll(" \x04[] \x05Simon Disabled the friendly fire to Ts!");
            
            
DOsimon(client,0);
        }
        else if ( 
strcmp(info,"kill") == 
        {
            new 
ale GetRandomPlayer(CS_TEAM_T);
            if(
ale 0)
            {
                
ForcePlayerSuicide(ale);
                
PrintToChatAll(" \x04[] \x05Simon killed randomly to %N"ale);
                
            }
            
DOsimon(client,0);
        }
        else if ( 
strcmp(info,"nosimon") == 
        {
            
FakeClientCommand(client"sm_nosimon");
            
DOMenu(client,0);
        }
        
    }
    else if (
action == MenuAction_End)
    {
        
CloseHandle(menu);
    }
}

public 
SetCvar(String:cvarName[64], value)
{
    new 
Handle:cvar;
    
cvar FindConVar(cvarName);

    new 
flags GetConVarFlags(cvar);
    
flags &= ~FCVAR_NOTIFY;
    
SetConVarFlags(cvarflags);

    
SetConVarInt(cvarvalue);

    
flags |= FCVAR_NOTIFY;
    
SetConVarFlags(cvarflags);
}

FDTodos()
{
    for (new 
1MaxClientsi++)
        if(
IsClientInGame(i) && IsPlayerAlive(i) && GetClientTeam(i) == CS_TEAM_T
            
JB_GiveFD(i);
}

FDone(client)
{
    new 
Handle:menu CreateMenu(DIDMenuHandlerFD);
    
SetMenuTitle(menu"Choose player to give FreeDay");
    
    
decl String:temp2[8], String:temp[128];
    new 
cuenta 0;
    for (new 
1MaxClientsi++)
    if(
IsClientInGame(i) && IsPlayerAlive(i) && GetClientTeam(i) == CS_TEAM_T && !JB_GetFD(i)) 
        {
            
Format(temp128"%N"i);
            
Format(temp28"%i"i);
            
AddMenuItem(menutemp2temp);
            
            
cuenta++;
        }
    
    
SetMenuExitButton(menutrue);
    
DisplayMenu(menuclientMENU_TIME_FOREVER);
    
    if(
cuenta == 0)
    {
        
PrintToChat(client" \x04[] \x05No players for give FreeDay");
        
DOsimon(client,0);
    }
}

public 
DIDMenuHandlerFD(Handle:menuMenuAction:actionclientitemNum
{
    if ( 
action == MenuAction_Select 
    {
        if(
"JC_GetCaptain"() != client) return;
        
        new 
String:info[32];
        
        
GetMenuItem(menuitemNuminfosizeof(info));
        
        new 
StringToInt(info);
        if(
IsClientInGame(i) && IsPlayerAlive(i) && GetClientTeam(i) == CS_TEAM_T
        {
            
JB_GiveFD(i);
            
PrintToChatAll(" \x04[] \x05Simon Given FreeDay to %N"i);
            
            
DOsimon(client,0);
        }
        else 
        {
            
PrintToChat(client" \x04[] \x05Target invalid. Choose other player");
            
FDone(client);
        }
        
    }
    else if (
action == MenuAction_End)
    {
        
CloseHandle(menu);
    }
}

GetRandomPlayer(team)
{
    new 
clients[MaxClients+1], clientCount;
    for (new 
1<= MaxClientsi++)
        if (
IsClientInGame(i) && GetClientTeam(i) == teamclients[clientCount++] = i;
        
    return (
clientCount == 0) ? -clients[GetRandomInt(0clientCount-1)];


Last edited by BloodBullet; 05-24-2020 at 12:36. Reason: fix tag
BloodBullet is offline