AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   (TF2) error with compiler (https://forums.alliedmods.net/showthread.php?t=297607)

Flynn_bat 05-18-2017 19:54

(TF2) error with compiler
 
Im getting a lot of compiler errors with the menu area of this code...
im using code from this area of the page, https://wiki.alliedmods.net/Commands...eMod_Scripting)

the errors are
/groups/sourcemod/upload_tmp/textTu3Hvq.sp(74) : error 029: invalid expression, assumed zero
/groups/sourcemod/upload_tmp/textTu3Hvq.sp(74) : warning 215: expression has no effect
/groups/sourcemod/upload_tmp/textTu3Hvq.sp(74) : error 001: expected token: ";", but found "int"
/groups/sourcemod/upload_tmp/textTu3Hvq.sp(74) : error 001: expected token: ";", but found "("
/groups/sourcemod/upload_tmp/textTu3Hvq.sp(74) : fatal error 189: too many error messages on one line


thanks m8






#include <sourcemod>
#include <sdktools>

////////////////////////////////////////////////////
////////////////////////////////////////////////////
/// ///
/// ///
/// Flynn's ///
/// ///
/// TTT ///
/// ///
/// ///
/// ///
/// ///
/// ///
/// ///
/// ///
/// ///
/// ///
/// ///
////////////////////////////////////////////////////
////////////////////////////////////////////////////


#include <sourcemod>
#include <sdktools>

public void OnPluginStart()
{
RegAdminCmd ("sm_TTT_over", Command_TTT_over, ADMFLAG_ROOT);
RegAdminCmd ("sm_TTT", Command_TTT, ADMFLAG_ROOT);
RegConsoleCmd("Menu_TTT_terrorist", Menu_TTT_terrorist);
RegConsoleCmd("Menu_TTT_Civillian", Menu_TTT_Civillian);
PrintToServer("mp_friendlyfire 1");
PrintToServer("mp_respawnwavetime 99999999999999999999999");
PrintToChatAll("!sm_classrestrict_blu_scouts" );

}
public Action Command_TTT_over(int client, int args)
{
PrintToServer("mp_friendlyfire 0");
PrintToServer("mp_respawnwavetime 0");
PrintToChatAll("!sm_classrestrict_enable 0");


}
public Action Command_TTT(int client, int args)
{
new Client;
if(GetTeamClientCount(2)>0)
{
do {
Client = GetRandomInt(1, MaxClients);
}
while(!IsClientInGame(Client) || GetClientTeam(Client) != 3);
}
for(new i = 1; i <= MaxClients; i++) {
RegConsoleCmd("Menu_TTT_terrorist", Menu_TTT_terrorist);
}

new Client2;
if(GetTeamClientCount(2) > 0) {
do {
Client2 = GetRandomInt(1, MaxClients);
}
while(!IsClientInGame(Client2) || GetClientTeam(Client2) != 3);
}
for(new i = 1; i <= MaxClients; i++) {
RegConsoleCmd("Menu_TTT_Civillian", Menu_TTT_Civillian);
}



public int MenuHandler1(Menu menu, MenuAction action, int param1, int param2)
{
/* If an option was selected, tell the client about the item. */
if (action == MenuAction_Select)
{
char info[32];
bool found = menu.GetItem(param2, info, sizeof(info));
PrintToConsole(param1, "You selected item: %d (found? %d info: %s)", param2, found, info);
}
/* If the menu was cancelled, print a message to the server about it. */
else if (action == MenuAction_Cancel)
{
PrintToServer("Client %d's menu was cancelled. Reason: %d", param1, param2);
}
/* If the menu has ended, destroy it */
else if (action == MenuAction_End)
{
delete menu;
}
}


public int MenuHandler2 (Menu menu, MenuAction action, int param1, int param2)
{
/* If an option was selected, tell the client about the item. */
if (action == MenuAction_Select)
{
char info[32];
bool found = menu.GetItem(param2, info, sizeof(info));
PrintToConsole(param1, "You selected item: %d (found? %d info: %s)", param2, found, info);
}
/* If the menu was cancelled, print a message to the server about it. */
else if (action == MenuAction_Cancel)
{
PrintToServer("Client %d's menu was cancelled. Reason: %d", param1, param2);
}
/* If the menu has ended, destroy it */
else if (action == MenuAction_End)
{
delete menu;
}
}
}

public Action Menu_TTT_terrorist(int client, int args)
{
Menu menu = new Menu(MenuHandler1);
menu.SetTitle("Terrorist");


return Plugin_Handled;
}

public Action Menu_TTT_Civillian(int client, int args)
{
Menu menu = new Menu(MenuHandler2);
menu.SetTitle("You are a Civilian");


return Plugin_Handled;
}

hmmmmm 05-19-2017 06:46

Re: (TF2) error with compiler
 
Why are you including twice? Also next time wrap the code with PHP or code tags so its actually readable, otherwise no one can see your issue.

After indenting it you can clearly see that you're missing a closing bracket for one function and you've added an extra one for another. Fixed code added

PHP Code:

////////////////////////////////////////////////////
////////////////////////////////////////////////////
///    ///
///    ///
///    Flynn's    ///
///    ///
///    TTT    ///
///    ///
///    ///
///    ///
///    ///
///    ///
///    ///
///    ///
///    ///
///    ///
///    ///
////////////////////////////////////////////////////
////////////////////////////////////////////////////

#include <sourcemod>
#include <sdktools>

public void OnPluginStart()
{
    
RegAdminCmd ("sm_TTT_over"Command_TTT_overADMFLAG_ROOT);
    
RegAdminCmd ("sm_TTT"Command_TTTADMFLAG_ROOT);
    
RegConsoleCmd("Menu_TTT_terrorist"Menu_TTT_terrorist);
    
RegConsoleCmd("Menu_TTT_Civillian"Menu_TTT_Civillian);    
    
PrintToServer("mp_friendlyfire 1");
    
PrintToServer("mp_respawnwavetime 99999999999999999999999");
    
PrintToChatAll("!sm_classrestrict_blu_scouts" );
}


public 
Action Command_TTT_over(int clientint args)
{
    
PrintToServer("mp_friendlyfire 0");
    
PrintToServer("mp_respawnwavetime 0");
    
PrintToChatAll("!sm_classrestrict_enable 0");
}

public 
Action Command_TTT(int clientint args)
{
    
int Client;
    if(
GetTeamClientCount(2)>0)
    {
        do {
            
Client GetRandomInt(1MaxClients);
        } 
        while(!
IsClientInGame(Client) || GetClientTeam(Client) != 3);
    }
    for(
int i 1<= MaxClientsi++) {
        
RegConsoleCmd("Menu_TTT_terrorist"Menu_TTT_terrorist);
    }

    
int Client2;
    if(
GetTeamClientCount(2) > 0) {
        do {
            
Client2 GetRandomInt(1MaxClients);
        } 
        while(!
IsClientInGame(Client2) || GetClientTeam(Client2) != 3);
    }
    
    for(
int i 1<= MaxClientsi++) {
        
RegConsoleCmd("Menu_TTT_Civillian"Menu_TTT_Civillian);
    }    
}


public 
int MenuHandler1(Menu menuMenuAction actionint param1int param2)
{
    
/* If an option was selected, tell the client about the item. */
    
if (action == MenuAction_Select)
    {
        
char info[32];
        
bool found menu.GetItem(param2infosizeof(info));
        
PrintToConsole(param1"You selected item: %d (found? %d info: %s)"param2foundinfo);
    }
        
/* If the menu was cancelled, print a message to the server about it. */
    
else if (action == MenuAction_Cancel)
    {
        
PrintToServer("Client %d's menu was cancelled. Reason: %d"param1param2);
    }
    
/* If the menu has ended, destroy it */
    
else if (action == MenuAction_End)
    {
        
delete menu;
    }
}

public 
int MenuHandler2 (Menu menuMenuAction actionint param1int param2)
{
    
/* If an option was selected, tell the client about the item. */
    
if (action == MenuAction_Select)
    {
        
char info[32];
        
bool found menu.GetItem(param2infosizeof(info));
        
PrintToConsole(param1"You selected item: %d (found? %d info: %s)"param2foundinfo);
    }
    
/* If the menu was cancelled, print a message to the server about it. */
    
else if (action == MenuAction_Cancel)
    {
        
PrintToServer("Client %d's menu was cancelled. Reason: %d"param1param2);
    }
    
/* If the menu has ended, destroy it */
    
else if (action == MenuAction_End)
    {
        
delete menu;
    }
}

public 
Action Menu_TTT_terrorist(int clientint args)
{
    
Menu menu = new Menu(MenuHandler1);
    
menu.SetTitle("Terrorist");

    return 
Plugin_Handled;
}

public 
Action Menu_TTT_Civillian(int clientint args)
{
    
Menu menu = new Menu(MenuHandler2);
    
menu.SetTitle("You are a Civilian");

    return 
Plugin_Handled;




All times are GMT -4. The time now is 18:58.

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