Raised This Month: $12 Target: $400
 3% 

Can some1 fix this 1 compile error..


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
blood2k
Senior Member
Join Date: Mar 2014
Old 12-23-2017 , 19:47   Can some1 fix this 1 compile error..
Reply With Quote #1

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




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 ) 
}
blood2k is offline
D3XT3R
AlliedModders Donor
Join Date: Nov 2016
Location: Lithuania, Bomb A (Kauna
Old 12-24-2017 , 04:33   Re: Can some1 fix this 1 compile error..
Reply With Quote #2

this is stuipid code and i dont have time to rewrite it all...
__________________
D3XT3R is offline
Send a message via Skype™ to D3XT3R
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 12-24-2017 , 05:15   Re: Can some1 fix this 1 compile error..
Reply With Quote #3

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.
__________________

Last edited by fysiks; 12-24-2017 at 05:16.
fysiks is offline
Rohanlogs
Senior Member
Join Date: Nov 2015
Old 12-24-2017 , 06:31   Re: Can some1 fix this 1 compile error..
Reply With Quote #4

Quote:
Originally Posted by D3XT3R View Post
this is stuipid code and i dont have time to rewrite it all...
Then why are you here?



Anyway..

Code:
id - = TASK_TEAM

Code:
id -= TASK_TEAM

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

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

That should fix your error.
__________________
Rohanlogs is offline
D3XT3R
AlliedModders Donor
Join Date: Nov 2016
Location: Lithuania, Bomb A (Kauna
Old 12-24-2017 , 12:49   Re: Can some1 fix this 1 compile error..
Reply With Quote #5

Quote:
Originally Posted by Rohanlogs View Post
Then why are you here?



Anyway..

Code:
id - = TASK_TEAM

Code:
id -= TASK_TEAM

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

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
__________________
D3XT3R is offline
Send a message via Skype™ to D3XT3R
blood2k
Senior Member
Join Date: Mar 2014
Old 12-24-2017 , 19:02   Re: Can some1 fix this 1 compile error..
Reply With Quote #6

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.
blood2k is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 12-24-2017 , 23:02   Re: Can some1 fix this 1 compile error..
Reply With Quote #7

There already exists plugins that manage AFK players. I recommend that you use one of those.

Here is one.
__________________

Last edited by fysiks; 12-24-2017 at 23:09.
fysiks is offline
blood2k
Senior Member
Join Date: Mar 2014
Old 12-25-2017 , 01:51   Re: Can some1 fix this 1 compile error..
Reply With Quote #8

Quote:
Originally Posted by fysiks View Post
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?
blood2k is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 12-25-2017 , 12:39   Re: Can some1 fix this 1 compile error..
Reply With Quote #9

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.
__________________
fysiks is offline
blood2k
Senior Member
Join Date: Mar 2014
Old 12-25-2017 , 14:08   Re: Can some1 fix this 1 compile error..
Reply With Quote #10

Quote:
Originally Posted by fysiks View Post
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.
blood2k is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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