AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Change the map and kick all clients (https://forums.alliedmods.net/showthread.php?t=40783)

eRik 07-03-2006 14:59

Change the map and kick all clients
 
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

shino 07-03-2006 16:12

Re: Change the map and kick all clients
 
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.

eRik 07-03-2006 16:33

Re: Change the map and kick all clients
 
how can i change it ingame ?
thnx btw:up:

Rolnaaba 07-03-2006 22:18

Re: Change the map and kick all clients
 
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)

eRik 07-04-2006 02:37

Re: Change the map and kick all clients
 
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:avast:

Hawk552 07-04-2006 11:36

Re: Change the map and kick all clients
 
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")     } }

eRik 07-04-2006 14:30

Re: Change the map and kick all clients
 
Thankyou, Hawk!:D

Zenith77 07-04-2006 15:43

Re: Change the map and kick all clients
 
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?

Hawk552 07-04-2006 16:01

Re: Change the map and kick all clients
 
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.

eRik 07-04-2006 16:06

Re: Change the map and kick all clients
 
so i have to read_argv from REASON ?


All times are GMT -4. The time now is 07:59.

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