Raised This Month: $ Target: $400
 0% 

Change the map and kick all clients


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
eRik
Junior Member
Join Date: Jul 2006
Location: HOLLAND!
Old 07-03-2006 , 14:59   Change the map and kick all clients
Reply With Quote #1

Ok i made this (with help from hawk) to kick all clients... it works but I want to change the map after evrybody is kicked

for example

I want to kick evrybody and change the map to de_cpl_fire
amx_changekick de_cpl_fire


Plugin:
Code:
// Kick all clients by eRik */

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Kick All Clients"
#define VERSION "0.1"
#define AUTHOR "eRik"
#define REASON "Mapchanging..."


public plugin_init()
{
    register_plugin(PLUGIN, VERSION, AUTHOR)
    register_concmd("amx_kickall","kick_all",ADMIN_KICK,"Kick all clients") 
    
}


stock kick_all (reason[])
{
    static iPlayers[32],iPlayersnum
    get_players(iPlayers,iPlayersnum)
    
    for(new iCount;iCount < iPlayersnum;iCount++)
        server_cmd("kick #%d %s",get_user_userid(iPlayers[iCount]),REASON)

    return PLUGIN_HANDLED
    
}
How can i make that can somebody help me
__________________
eRik is offline
shino
Senior Member
Join Date: May 2006
Old 07-03-2006 , 16:12   Re: Change the map and kick all clients
Reply With Quote #2

Code:
// Kick all clients by eRik */ #include <amxmodx> #include <amxmisc> #define PLUGIN "Kick All Clients" #define VERSION "0.1" #define AUTHOR "eRik" #define REASON "Mapchanging..." public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_concmd("amx_kickall","kick_all",ADMIN_KICK,"Kick all clients")     } stock kick_all (reason[]) {     static iPlayers[32],iPlayersnum     get_players(iPlayers,iPlayersnum)         for(new iCount;iCount < iPlayersnum;iCount++)         server_cmd("kick #%d %s",get_user_userid(iPlayers[iCount]),REASON)         set_task(0.2,"changemap")     return PLUGIN_HANDLED     } public changemap() {     server_cmd("changelevel de_dust2") }

sure, you can change de_dust2 to everything you want, or even better, you can leave this decision to server managers by cvar.
shino is offline
eRik
Junior Member
Join Date: Jul 2006
Location: HOLLAND!
Old 07-03-2006 , 16:33   Re: Change the map and kick all clients
Reply With Quote #3

how can i change it ingame ?
thnx btw
__________________
eRik is offline
Rolnaaba
Veteran Member
Join Date: May 2006
Old 07-03-2006 , 22:18   Re: Change the map and kick all clients
Reply With Quote #4

you cant change it in game if u want to make it changeable in game u need to make it like this:
Code:
// Kick all clients by eRik */

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Kick All Clients"
#define VERSION "0.1"
#define AUTHOR "eRik"
#define REASON "Mapchanging..."


public plugin_init()
{
    register_plugin(PLUGIN, VERSION, AUTHOR)
    register_concmd("amx_kickall","kick_all",ADMIN_KICK,"Kick all clients")
register_cvar("mapname", "de_dust2")
    
}


stock kick_all (reason[])
{
    static iPlayers[32],iPlayersnum
    get_players(iPlayers,iPlayersnum)
    
    for(new iCount;iCount < iPlayersnum;iCount++)
        server_cmd("kick #%d %s",get_user_userid(iPlayers[iCount]),REASON)
        set_task(0.2,"changemap")

    return PLUGIN_HANDLED
    
}

public changemap()
{
    server_cmd("changelevel "get_cvar_string("mapname")"")
}

then just change the cvar to w/e u want
(think get_cvar_string should work not sure tho)
__________________
DO NOT PM me about avp mod.

Last edited by Rolnaaba; 07-03-2006 at 22:22.
Rolnaaba is offline
eRik
Junior Member
Join Date: Jul 2006
Location: HOLLAND!
Old 07-04-2006 , 02:37   Re: Change the map and kick all clients
Reply With Quote #5

This doesn't work


errors
Code:
Welcome to the AMX Mod X 1.70-300 Compiler.
Copyright (c) 1997-2005 ITB CompuPhase, AMX Mod X Team

Warning: Loose indentation on line 16
Error: Expected token: ",", but found "-identifier-" on line 36
Error: Expected token: ";", but found "-identifier-" on line 36
Error: Undefined symbol "mapname" on line 36
Error: Too many error messages on one line on line 36

Compilation aborted.
4 Errors.
Could not locate output file C:\HLServer\cstrike\addons\amxmodx\plugins\Untitled.amx (compile failed).
[offtopic]
Damn they have to fix that funcwiki , its so nice
__________________
eRik is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 07-04-2006 , 11:36   Re: Change the map and kick all clients
Reply With Quote #6

I'm amazed by the thing I said in new plugins and people posting when they have no clue at all what they're talking about.

Code:
/* Kick all clients by eRik */ #include <amxmodx> #include <amxmisc> #define PLUGIN "Kick All Clients" #define VERSION "0.1" #define AUTHOR "eRik" #define REASON "Mapchanging..." new g_pMap public plugin_init() {       register_plugin(PLUGIN, VERSION, AUTHOR)           register_concmd("amx_kickall","kick_all",ADMIN_KICK,"Kick all clients")         g_pMap = register_cvar("mapname","de_dust2") } // must be public if you call it like this public kick_all(reason[]) {       // because it can only be used once, might as well make it new     new iPlayers[32],iPlayersnum     get_players(iPlayers,iPlayersnum)           for(new iCount;iCount < iPlayersnum;iCount++)           server_cmd("kick #%d %s",get_user_userid(iPlayers[iCount]),REASON)           changemap()         // you don't need to return PLUGIN_HANDLED everywhere, in fact in most cases it might     // screw up your script } // doesn't have to be public, it's called internally (wtf was up with the set_task?) changemap() {     new szMap[33]     get_pcvar_string(g_pMap,szMap,32)         if(is_map_valid(szMap))         server_cmd("changelevel %s",szMap)     else     {         log_amx("Error: map specified not valid, defaulting to de_dust2")             server_cmd("changelevel de_dust2")     } }
__________________

Last edited by Hawk552; 07-04-2006 at 11:39. Reason: the leprechauns did it
Hawk552 is offline
Send a message via AIM to Hawk552
eRik
Junior Member
Join Date: Jul 2006
Location: HOLLAND!
Old 07-04-2006 , 14:30   Re: Change the map and kick all clients
Reply With Quote #7

Thankyou, Hawk!
__________________
eRik is offline
Zenith77
Veteran Member
Join Date: Aug 2005
Old 07-04-2006 , 15:43   Re: Change the map and kick all clients
Reply With Quote #8

Shouldn't the kick_all function definition be like this...

Code:
  public kick_all(id, level, cid) {      if(!cmd_access(id, level, cid, 1))           return PLUGIN_HANDLED;      // other code here... }

or was there a major change between 1.70-1.75 that I don't know about?
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred
Zenith77 is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 07-04-2006 , 16:01   Re: Change the map and kick all clients
Reply With Quote #9

Quote:
Originally Posted by Zenith77
Shouldn't the kick_all function definition be like this...

[snipped due to edit bug]

or was there a major change between 1.70-1.75 that I don't know about?
Yes, but that's a more minor thing.

EDIT: Also, I just realized, the reason will always be blank unless you read the arg.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
eRik
Junior Member
Join Date: Jul 2006
Location: HOLLAND!
Old 07-04-2006 , 16:06   Re: Change the map and kick all clients
Reply With Quote #10

so i have to read_argv from REASON ?
__________________
eRik is offline
Reply



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 07:59.


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