AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   Solved fatal error 186: insufficient memory (https://forums.alliedmods.net/showthread.php?t=324639)

BloodBullet 05-22-2020 05:19

fatal error 186: insufficient memory
 
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)];



Ilusion9 05-22-2020 07:02

Re: fatal error 186: insufficient memory
 
put the code in php tag.

BloodBullet 05-22-2020 07:41

Re: fatal error 186: insufficient memory
 
Quote:

Originally Posted by Ilusion9 (Post 2701575)
put the code in php tag.

And how to do that ?

Kellan123 05-22-2020 12:30

Re: fatal error 186: insufficient memory
 
leak, use next time [ PHP ] code [ /PHP ]

Silvers 05-22-2020 14:08

Re: fatal error 186: insufficient memory
 
Doesn't it give you a line number for the error?

Use sizeof() instead of hard coding values when using Format etc.

Also old syntax ewww.

Oh and why are double posting the same thing? ffs.

BloodBullet 05-23-2020 02:22

Re: fatal error 186: insufficient memory
 
Quote:

Originally Posted by Silvers (Post 2701641)
Doesn't it give you a line number for the error?

Use sizeof() instead of hard coding values when using Format etc.

Also old syntax ewww.

Oh and why are double posting the same thing? ffs.


//SourceMod Batch Compiler
// by the SourceMod Dev Team


//// jailbreak_menu.sp
//
// E:\CSGO_ServerMain\csgo\addons\sourcemod\scri pting\jailbreak_menu.sp(238) : fatal error 186: insufficient memory
//
// Compilation aborted.
// 1 Error.
//
// Compilation Time: 0.09 sec
// ----------------------------------------

Press enter to exit ...

Ilusion9 05-23-2020 04:43

Re: fatal error 186: insufficient memory
 
Search for JC_GetCaptain and fix it, remove those quotes and maybe put them inside the paranthesis ().

PHP Code:

 if("JC_GetCaptain"() == client

this is wrong

BloodBullet 05-23-2020 05:47

Re: fatal error 186: insufficient memory
 
Quote:

Originally Posted by Ilusion9 (Post 2701738)
Search for JC_GetCaptain and fix it, remove those quotes and maybe put them inside the paranthesis ().

PHP Code:

 if("JC_GetCaptain"() == client

this is wrong

I removed the quotes and shows
PHP Code:

// E:\CSGO_ServerMain\csgo\addons\sourcemod\scripting\jailbreak_menu.sp(26) : error 017: undefined symbol "JC_GetCaptain"
// E:\CSGO_ServerMain\csgo\addons\sourcemod\scripting\jailbreak_menu.sp(121) : error 017: undefined symbol "JC_GetCaptain"
// E:\CSGO_ServerMain\csgo\addons\sourcemod\scripting\jailbreak_menu.sp(238) : error 017: undefined symbol "JC_GetCaptain"
// E:\CSGO_ServerMain\csgo\addons\sourcemod\scripting\jailbreak_menu.sp(238) : error 001: expected token: ")", but found "return" 

And to define the symbol i used "JC_GetCaptain" from this script
PHP Code:

#include <sourcemod>
#include <sdktools>
#include <basecomm>
#include <cstrike>
#include <franug_jb>


#pragma semicolon 1


#define DATA "4.4"


new commander;

public 
APLRes:AskPluginLoad2(Handle:myselfbool:lateString:error[], err_max)
{
    
CreateNative("JC_GetCaptain"Native_Obtener);
    
    return 
APLRes_Success;
}

public 
Native_Obtener(Handle:pluginargc)
{    
        return 
commander;
}

public 
OnPluginStart()
{

    
LoadTranslations ("captain.phrases");

    
CreateConVar("sm_FranugSimon_version"DATA"version"FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY);

    
RegAdminCmd("sm_removesimon"command_removecaptainADMFLAG_GENERIC);
        
RegConsoleCmd("sm_simon"Co);
        
RegConsoleCmd("sm_c"Co);
        
RegConsoleCmd("sm_nosimon"unCo);
        
RegConsoleCmd("sm_noc"unCo);

    
HookEvent("round_start"roundStart);
    
HookEvent("player_death"playerDeath);
    
HookEvent("player_disconnect"playerDisconnect);


}

public 
Action:command_removecaptain(clientargs)
{
    if(
IsValidClient(commander))
    {
        
PrintToChatAll(" \x04[Jail_Simon] \x03%t""Captain has been removed by an administrator. You can now choose a new one");
        
commander = -1;
        return 
Plugin_Handled;
    }

    
PrintToChat(client" \x04[Jail_Simon] \x03%t""Captain still not exist!");

    return 
Plugin_Handled;
}

public 
Action:Co(client,args)
{
    
decl String:ronda[64];
    
JB_GetRound(ronda);
    if(!
StrEqual(ronda"Simon"false))
    {
        
PrintToChat(client" \x04[Jail_Simon] \x03Only simon is allowed the simon day!");
        return 
Plugin_Handled;
    }
    
    
    if(!
client)
        return 
Plugin_Handled;

    if(!
IsValidClient(commander))
    {
        if(
IsValidClient(client) && GetClientTeam(client) == && IsPlayerAlive(client))
        {
                   
//SetEntityRenderColor(client, 255, 150, 0, 255);
                
commander client;
                
                
FakeClientCommand(client"sm_simonmenu");
        }
        else
        {
            
PrintToChat(client" \x04[Jail_Simon] \x03%t""You must be alive or be a CT for be a captain!");
        }
    }
    else
    {
        
PrintToChat(client" \x04[Jail_Simon] \x03%t""Captain already exist!");
    }

    return 
Plugin_Handled;
}

public 
Action:unCo(client,args)
{
    if(
commander == client)
    {
           
DesNombradoC(client);
           
//SetEntityRenderColor(client, 255, 255, 255, 255);
           
commander = -1;
    }
    else
    {
       
PrintToChat(client" \x04[Jail_Simon] \x03%t""You are not the captain!");
    }
}

public 
Action:roundStart(Handle:event, const String:name[], bool:dontBroadcast
{
    
commander = -1;
    
    
decl String:ronda[64];
    
JB_GetRound(ronda);
    if(!
StrEqual(ronda"Simon"false))
    {
        return;
    }
    
    new 
client GetRandomPlayer(CS_TEAM_CT);
    if(
client 0)
    {
        
        
commander client;
        
        
FakeClientCommand(client"sm_simonmenu");
    }
    
}

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)];
}



public 
Action:playerDisconnect(Handle:event, const String:name[], bool:dontBroadcast
{
        new 
client GetClientOfUserId(GetEventInt(event"userid"));

    if(
client == commander)
        {
       
DesNombradoC(client);
       
commander = -1;
        }
}

public 
Action:playerDeath(Handle:event, const String:name[], bool:dontBroadcast
{
        new 
client GetClientOfUserId(GetEventInt(event"userid"));

    if(
client == commander)
        {
       
DesNombradoC(client);
       
commander = -1;
        }
}

DesNombradoC(client)
{
    
decl String:nombre[32];
    
GetClientName(clientnombresizeof(nombre));
    
PrintToChatAll(" \x04[Jail_Simon] \x03%t""no longer"nombre);
}






public 
IsValidClientclient 

    if ( !( 
<= client <= MaxClients ) || !IsClientInGame(client) ) 
        return 
false
     
    return 
true



jugule 05-23-2020 22:49

Re: fatal error 186: insufficient memory
 
if("JC_GetCaptain"() == client)
->>
if(JC_GetCaptain() == client)

BloodBullet 05-24-2020 01:20

Re: fatal error 186: insufficient memory
 
Quote:

Originally Posted by jugule (Post 2701953)
if("JC_GetCaptain"() == client)
->>
if(JC_GetCaptain() == client)

PHP Code:

//SourceMod Batch Compiler
// by the SourceMod Dev Team


//// jailbreak_menu.sp
//
// E:\CSGO_ServerMain\csgo\addons\sourcemod\scripting\jailbreak_menu.sp(26) : error 017: undefined symbol "JC_GetCaptain"
// E:\CSGO_ServerMain\csgo\addons\sourcemod\scripting\jailbreak_menu.sp(121) : error 017: undefined symbol "JC_GetCaptain"
// E:\CSGO_ServerMain\csgo\addons\sourcemod\scripting\jailbreak_menu.sp(238) : error 017: undefined symbol "JC_GetCaptain"
//
// 3 Errors.
//
// Compilation Time: 0.41 sec
// ----------------------------------------

Press enter to exit ... 

Now this ...


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

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