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

Little Help Learning


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Ezekiel
Member
Join Date: Mar 2004
Old 03-19-2004 , 10:47   Little Help Learning
Reply With Quote #1

I am using this ping kickeing plugin to learn from, i understand most of it, but there are a few things i dont get anybodies help would be much appreciated.

Code:
public client_disconnect(id) {
	remove_task(id)
	return PLUGIN_CONTINUE
}
Telling the plugin to stop checking someone when they disconnect? Am not so sure about this, or how it works.

Code:
public client_putinserver(id) {
	iNumTests[id] = 0
	if (!is_user_bot(id)) {
		new param[1]
		param[0] = id
		set_task(30.0, "showWarn", id, param, 1)
	}
	return PLUGIN_CONTINUE
}
When a player connects, if theyre not a bot show them a warning. But i dont understand why/how this is done with param?
Ezekiel is offline
Geesu
Veteran Member
Join Date: Mar 2004
Location: Cincinnati, OH
Old 03-19-2004 , 10:49  
Reply With Quote #2

Post the showwarn function.
__________________
Need war3ft help? DO NOT PM ME... Check the forums
Geesu is offline
Send a message via AIM to Geesu Send a message via MSN to Geesu
Ezekiel
Member
Join Date: Mar 2004
Old 03-19-2004 , 10:56  
Reply With Quote #3

Code:
public showWarn(param[]) {
	client_print(param[0], print_chat, "Players with ping higher than %dms will be kicked!", HIGHPING_MAX)
	set_task(float(HIGHPING_TIME), "checkPing", param[0], param, 1, "b")
	return PLUGIN_CONTINUE
}
Ezekiel is offline
Geesu
Veteran Member
Join Date: Mar 2004
Location: Cincinnati, OH
Old 03-19-2004 , 11:10  
Reply With Quote #4

Set_task functions (can) use parameters to pass data to them. Most programmers use the first element of the array to store the user's ID

param[0] = id

You can then use other parts of the array to store other various unformation, like the player's origin, etc...

param[1] = origin[0] // x value
param[2] = origin[1] // y value
param[3] = origin[2] // z value

native set_task(Float:time,const function[],id = 0,parameter[]="",len = 0,flags[]="", repeat = 0);
__________________
Need war3ft help? DO NOT PM ME... Check the forums
Geesu is offline
Send a message via AIM to Geesu Send a message via MSN to Geesu
Ezekiel
Member
Join Date: Mar 2004
Old 03-19-2004 , 11:16  
Reply With Quote #5

thanks
Ezekiel is offline
Ezekiel
Member
Join Date: Mar 2004
Old 03-19-2004 , 12:08  
Reply With Quote #6

ok so heres where ive gotten to: (the numbers on the left are line nos)

Code:
/* AMX Mod script
* 
* (c) 2004, Ezekiel
* This file is provided as is (no warranties).
*
* A plugin that will generate a value based on player kill minus player deaths
* and kick if this value is below a certain value.
*
* Players with immunity won't be checked
*/

#include <amxmod>

new RATIO = -5 // the number kills-deaths has to equal or be smaller than for the user to be kicked and banned
new MINPLAYERS = 12 // number of players to be on server before plugin works

public plugin_init() {
	register_plugin("Low Skill Kicker","0.1","Ezekiel")
	return PLUGIN_CONTINUE
20}

public client_disconnect(id) {
	remove_task(id)
	return PLUGIN_CONTINUE
}

kickPlayer(id) {
	new name[32]
	get_user_name(id, name, 31)
30	new uID = get_user_userid(id)
	server_cmd("banid 240 #%d", uID)
	client_cmd(id, "echo ^"Sorry but you don't have a high enough score^"; disconnect")
	client_print(0, print_chat, "%s was disconnected due to being shite!", name)
	return PLUGIN_CONTINUE
}
public checkScore(param[]) {
	new id = param[0]
	if ((get_user_flags(id) & ADMIN_RESERVATION)) {
		remove_task(id)
40		client_print(id, print_chat, "Score checking disabled due to immunity...you'd best not be shite! ;)")
		return PLUGIN_CONTINUE
	}
	new PLAYERS = get_playersnum()
	if ( PLAYERS >= MINPLAYERS)
	new FRAGS = get_user_frags(id)
	new DEATHS = get_user_deaths(id)
	new KD = FRAGS - DEATHS
	if (KD =< RATIO)
		kickPlayer(id)
50		return PLUGIN_CONTINUE
	else
		return PLUGIN_CONTINUE
	else
		return PLUGIN_CONTINUE
}
so very wrong.

errors:

Code:
/home/users/amxmodx/tmp/phpeqpO3Z.sma(48) : warning 211: possibly unintended assignment
/home/users/amxmodx/tmp/phpeqpO3Z.sma(48) : error 029: invalid expression, assumed zero
/home/users/amxmodx/tmp/phpeqpO3Z.sma(48) : warning 215: expression has no effect
/home/users/amxmodx/tmp/phpeqpO3Z.sma(48) : error 001: expected token: ";", but found ")"
/home/users/amxmodx/tmp/phpeqpO3Z.sma(48) : error 029: invalid expression, assumed zero
/home/users/amxmodx/tmp/phpeqpO3Z.sma(49) : warning 217: loose indentation
/home/users/amxmodx/tmp/phpeqpO3Z.sma(51) : warning 217: loose indentation
/home/users/amxmodx/tmp/phpeqpO3Z.sma(51) : error 029: invalid expression, assumed zero
/home/users/amxmodx/tmp/phpeqpO3Z.sma(51 -- 52) : warning 215: expression has no effect
/home/users/amxmodx/tmp/phpeqpO3Z.sma(52) : warning 217: loose indentation
/home/users/amxmodx/tmp/phpeqpO3Z.sma(53) : warning 217: loose indentation
/home/users/amxmodx/tmp/phpeqpO3Z.sma(53) : error 029: invalid expression, assumed zero
/home/users/amxmodx/tmp/phpeqpO3Z.sma(53 -- 54) : warning 215: expression has no effect
/home/users/amxmodx/tmp/phpeqpO3Z.sma(54) : warning 217: loose indentation
/home/users/amxmodx/tmp/phpeqpO3Z.sma(55) : warning 204: symbol is assigned a value that is never used: "KD"

5 Errors.
so help me learn from mistakes...thankyou
Ezekiel is offline
Geesu
Veteran Member
Join Date: Mar 2004
Location: Cincinnati, OH
Old 03-19-2004 , 12:37  
Reply With Quote #7

Code:
   if (KD =< RATIO)       kickPlayer(id) 50      return PLUGIN_CONTINUE    else       return PLUGIN_CONTINUE    else       return PLUGIN_CONTINUE

Should be
Code:
if (KD <= RATIO)    kickPlayer(id) else    return PLUGIN_CONTINUE
__________________
Need war3ft help? DO NOT PM ME... Check the forums
Geesu is offline
Send a message via AIM to Geesu Send a message via MSN to Geesu
PM
hello, i am pm
Join Date: Jan 2004
Location: Canalization
Old 03-19-2004 , 12:44  
Reply With Quote #8

hmm this whole func
Code:
public checkScore(param[]) {    new id = param[0]    if ((get_user_flags(id) & ADMIN_RESERVATION)) {       remove_task(id) 40      client_print(id, print_chat, "Score checking disabled due to immunity...you'd best not be shite! ;)")       return PLUGIN_CONTINUE    }    new PLAYERS = get_playersnum()    if ( PLAYERS >= MINPLAYERS)    new FRAGS = get_user_frags(id)    new DEATHS = get_user_deaths(id)    new KD = FRAGS - DEATHS    if (KD =< RATIO)       kickPlayer(id) 50      return PLUGIN_CONTINUE    else       return PLUGIN_CONTINUE    else       return PLUGIN_CONTINUE }

should probably be:
Code:
public checkScore(param[]) {    new id = param[0]    if ((get_user_flags(id) & ADMIN_RESERVATION)) {       remove_task(id)       client_print(id, print_chat, "Score checking disabled due to immunity...you'd best not be shite! ;)")       return PLUGIN_CONTINUE    }    new PLAYERS = get_playersnum()    if ( PLAYERS >= MINPLAYERS) {       new FRAGS = get_user_frags(id)       new DEATHS = get_user_deaths(id)       new KD = FRAGS - DEATHS       if (KD =< RATIO)       {          kickPlayer(id)          return PLUGIN_CONTINUE       }       else {          return PLUGIN_CONTINUE       }    }    else {       return PLUGIN_CONTINUE    } }
__________________
hello, i am pm
PM is offline
Ezekiel
Member
Join Date: Mar 2004
Old 03-20-2004 , 09:22  
Reply With Quote #9

Thankyou, i now have it at this stage:

Code:
/* AMX Mod script
* 
* (c) 2004, Ezekiel
* This file is provided as is (no warranties).
*
* A plugin that will generate a value based on player kill minus player deaths
* and kick if this value is below a certain value.
*
* Players with immunity won't be checked
*/

#include <amxmod>

new RATIO = -5 // the number kills-deaths has to equal or be smaller than for the user to be kicked and banned
new MINPLAYERS = 12 // number of players to be on server before plugin works
new BANTIME = 240 // amount of time to ban people for

public plugin_init() {
	register_plugin("Low Skill Kicker","1.0","Ezekiel")
	return PLUGIN_CONTINUE
}

public client_disconnect(id) {
	remove_task(id)
	return PLUGIN_CONTINUE
}

kickPlayer(id) {
	new name[32]
	get_user_name(id, name, 31)
	new uID = get_user_userid(id)
	server_cmd("banid %d #%d", BANTIME, uID)
	client_cmd(id, "echo ^"Sorry but you don't have a high enough score^"; disconnect")
	client_print(0, print_chat, "%s was disconnected due to being shite!", name)
	return PLUGIN_CONTINUE
}

public checkScore(param[]) 
{ 
   new id = param[0] 
   if ((get_user_flags(id) & ADMIN_RESERVATION)) { 
      remove_task(id) 
      client_print(id, print_chat, "Score checking disabled due to immunity...you'd best not be shite! ") 
      return PLUGIN_CONTINUE 
   } 

   new PLAYERS = get_playersnum() 
   if ( PLAYERS >= MINPLAYERS) { 
      new FRAGS = get_user_frags(id) 
      new DEATHS = get_user_deaths(id) 
      new KD = FRAGS - DEATHS 
      if (KD <= RATIO) 
      { 
         kickPlayer(id) 
         return PLUGIN_CONTINUE 
      } 
      else { 
         return PLUGIN_CONTINUE 
      } 
   } 
   else { 
      return PLUGIN_CONTINUE 
   }
   return PLUGIN_CONTINUE 
}
It compiles correctly but I'm missing the part to actually get it to work arent i?
Ezekiel is offline
IceMouse[WrG]
Senior Member
Join Date: Mar 2004
Old 03-20-2004 , 09:44  
Reply With Quote #10

Looks to me like your public_putinserver() isn't in there
IceMouse[WrG] is offline
Send a message via AIM to IceMouse[WrG] Send a message via MSN to IceMouse[WrG] Send a message via Yahoo to IceMouse[WrG]
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 13:24.


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