AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   Can some1 fix this 1 compile error.. (https://forums.alliedmods.net/showthread.php?t=303844)

blood2k 12-23-2017 19:47

Can some1 fix this 1 compile error..
 
There's an invalid character constant did a little research trying to figure out HOW to fix it.. but I don't know how to trouble shoot at all lol so I'm stuck trying to figure out why it's not working. It should be very simple for some1 who knows what they're doing and not a noob like me :shock::oops:




Code:

#include <amxmodx>

#define PLUGIN "No Team Unassigned"
#define VERSION "1.0"
#define AUTHOR "alan_el_more"

#define TASK_TEAM 9853

new g_count [ 33 ]
new g_jointeam [ 33 ]

new  const MAX_TIME = 30
new  const RAZON_KICK [ ] = "Do not choose a team"

public plugin_init ( )
{
    register_plugin ( PLUGIN, VERSION, AUTHOR )
   
    register_event ( "TeamInfo" , "fwPlayerJoinedTeam" , "a" , "2 = TERRORIST" , "2 = CT" )
}

public client_putinserver ( id )
{
    g_jointeam [ id ] = 0
   
    g_count [ id ] = MAX_TIME
    set_task ( 1.0 , "check_team" , id + TASK_TEAM, _, _, "b" )
}

public check_team ( id )
{
    id - = TASK_TEAM
   
    if ( --g_count [ id ] == 0 )
    {
        server_cmd ( "kick #% d ^" % s ^ "" , get_user_userid ( id ) , RAZON_KICK )
    }
   
    client_print ( id, print_center, "You have% d sec to choose a team" , g_count [ id ] )
}

public fwPlayerJoinedTeam ( )
{
    new id = read_data ( 1 )
   
    if ( ! g_jointeam [ id ] )
    {   
        // Team chosen
        g_jointeam [ id ] = 1
    }
    else
    {
        // Class chosen
        g_jointeam [ id ] = 0
        remove_task ( id + TASK_TEAM )
        g_count [ id ] = 0
    }
}

public client_disconnect ( id )
{
    g_count [ id ] = 0
    remove_task ( id + TASK_TEAM )
}


D3XT3R 12-24-2017 04:33

Re: Can some1 fix this 1 compile error..
 
this is stuipid code and i dont have time to rewrite it all...

fysiks 12-24-2017 05:15

Re: Can some1 fix this 1 compile error..
 
It's probably the escape character followed by a space or the format character followed by a space that is causing it. This was probably caused by the insanely excessive use of spaces in the code. You don't need to use a space after everything, it also make it very annoying to read the code.

Rohanlogs 12-24-2017 06:31

Re: Can some1 fix this 1 compile error..
 
Quote:

Originally Posted by D3XT3R (Post 2567901)
this is stuipid code and i dont have time to rewrite it all...

Then why are you here?



Anyway..

Code:
id - = TASK_TEAM
:arrow:
Code:
id -= TASK_TEAM

Code:
server_cmd ( "kick #% d ^" % s ^ "" , get_user_userid ( id ) , RAZON_KICK )
:arrow:
Code:
server_cmd ( "kick #%d ^" %s ^"" , get_user_userid ( id ) , RAZON_KICK )

That should fix your error.

D3XT3R 12-24-2017 12:49

Re: Can some1 fix this 1 compile error..
 
Quote:

Originally Posted by Rohanlogs (Post 2567919)
Then why are you here?



Anyway..

Code:
id - = TASK_TEAM
:arrow:
Code:
id -= TASK_TEAM

Code:
server_cmd ( "kick #% d ^" % s ^ "" , get_user_userid ( id ) , RAZON_KICK )
:arrow:
Code:
server_cmd ( "kick #%d ^" %s ^"" , get_user_userid ( id ) , RAZON_KICK )

That should fix your error.

i could read the code every thing f up

blood2k 12-24-2017 19:02

Re: Can some1 fix this 1 compile error..
 
I've been told the code is a little weird. But I applied the above fixes to it.

it's supposed to set a task to kick any "Unassigned" players.. but after fixing I can finally compile it.. just the plugin doesnt work as intended.

It's supposed to remove the task once it recognizes that the player joined a team already.. but instead it continues to show the countdown and still kicks regardless if the player is unassigned or assigned.

Could some1 maybe cut this down to something cleaner? 30 second timer for unassigned players, and if they assigned remove_task? Getting tired of people sitting in my pug server on map changes without getting kicked, this should limit the afk's a bit and kick them out.:)

fysiks 12-24-2017 23:02

Re: Can some1 fix this 1 compile error..
 
There already exists plugins that manage AFK players. I recommend that you use one of those.

Here is one.

blood2k 12-25-2017 01:51

Re: Can some1 fix this 1 compile error..
 
Quote:

Originally Posted by fysiks (Post 2568042)
There already exists plugins that manage AFK players. I recommend that you use one of those.

Here is one.

Thanks man.. problem with that is it's just too extensive I mean I know i can set everything I'm not using like AFK bomb transfer & etc.... to being off.. but it would just be nice to have a plugin that kicks unassigned players after 30 seconds without anything extra. Maybe I'm asking too much.. but it should be easy for most who can script.. I'll send some money your way if you don't mind? anyone? :)

fysiks 12-25-2017 12:39

Re: Can some1 fix this 1 compile error..
 
You're certainly welcome to wait to see if someone will do it for you but in my experience, if a plugin already exists that does what you want, it's less likely that someone would spend the time to re-write a subset of its functionality.

blood2k 12-25-2017 14:08

Re: Can some1 fix this 1 compile error..
 
Quote:

Originally Posted by fysiks (Post 2568100)
You're certainly welcome to wait to see if someone will do it for you but in my experience, if a plugin already exists that does what you want, it's less likely that someone would spend the time to re-write a subset of its functionality.

Ahh well put, I'll hang around see if anyone has any interest.


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

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