Raised This Month: $ Target: $400
 0% 

Slap max 2?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Nick
Senior Member
Join Date: Apr 2004
Location: Canada, Alberta, Cal
Old 07-05-2004 , 03:42   Slap max 2?
Reply With Quote #1

Well ok I finally got my slapall to work but it only slaps 2 people at a time.
Is it a problem with my script, or is it not possible to slap more than 2 people at once.
Code:
public slap_player(ids[]) {     new id = ids[0]         new slapdmg = (get_cvar_num("sv_slappower"))         new slapnum = (get_cvar_num("sv_numslaps"))     user_slap(id,slapdmg,slapnum)         return PLUGIN_CONTINUE } public admin_slapall(id,level,cid) {     if (!cmd_access(id,level,cid,1)){         return PLUGIN_HANDLED         }     new plist[32],pnum     get_players(plist, pnum ,"a")     for(new i=0; i<pnum; i++)     set_task(get_cvar_float("sv_slappower"),"slap_player", 0, plist, 1, "a", get_cvar_num("sv_numslaps"))     console_print(0,"All players have been slapped")     client_print(0,print_center,"All players have been slapped")     return PLUGIN_HANDLED } public amx_slappower(id,level,cid){     if (!cmd_access(id,level,cid,2))         return PLUGIN_HANDLED     new arg[8]     read_argv(1,arg,7)     if ((str_to_num(arg) > 100) || (str_to_num(arg) < 1)){         console_print(id,"[AMXX] MAX slap power is 20")                   return PLUGIN_HANDLED        }     set_cvar_string("sv_slappower",arg)     return PLUGIN_HANDLED          }     public amx_numslaps(id,level,cid){     if (!cmd_access(id,level,cid,2))         return PLUGIN_HANDLED     new arg[8]     read_argv(1,arg,7)     if ((str_to_num(arg) > 100) || (str_to_num(arg) < 2)){         console_print(id,"[AMXX] MAX slaps is 100")                   return PLUGIN_HANDLED        }     set_cvar_string("sv_numslaps",arg)     return PLUGIN_HANDLED          }
[/code]
__________________
Nick is offline
Send a message via MSN to Nick
Ryan
Senior Member
Join Date: May 2004
Location: NH, USA
Old 07-05-2004 , 11:06  
Reply With Quote #2

i see you are setting a task for the actuall slapping:
Code:
set_task(get_cvar_float("sv_slappower"),"slap_player", 0, plist, 1, "a", get_cvar_num("sv_numslaps"))

the formatting for this is incorrect, as shown by the definition...

Code:
/* Calls function on specified time. * Flags: * "a" - repeat. * "b" - loop task. * "c" - do task on time after a map timeleft. * "d" - do task on time before a map timelimit. */ native set_task(Float:time,const function[],id = 0,parameter[]="",len = 0,flags[]="", repeat = 0);

you seem to be passing the damage in the time slot by mistake, which may be causing the problem(s).

you can slap everyone at once, yes here's one way of doing it with your current setup.

Code:
public slap_all() {          // replaces slap_player()     new slapdmg = get_cvar_num( "sv_slappower" );     new Players[32], iTotalPlayers;     get_players( Players, iTotalPlayers , "a" );     for ( new i = 0; i < iTotalPlayers; i++ )     {         new id = Players[i];         user_slap( id, slapdmg );     }     return PLUGIN_HANDLED; } public admin_slapall( id, level, cid ) {     if ( !cmd_access( id, level, cid, 1 ) )         return PLUGIN_HANDLED;     new slapnum = get_cvar_num( "sv_numslaps" ) - 1;    // we're going to slap once immediately, then set a small timer if there are any more slaps to perform.     slap_all();     if ( slapnum > 0 )     {         set_task( 0.1, "slap_all", 0, "", 0, "a", slapnum );     }     console_print( 0, "All players have been slapped" );     client_print( 0, print_center, "All players have been slapped" );     return PLUGIN_HANDLED; }

This should work
__________________
Warcraft 3: Expansion
Homepage | Downloads | Forums
Ryan is offline
Send a message via AIM to Ryan
FroXeN
Senior Member
Join Date: Apr 2004
Location: Freecode is a loser.
Old 07-05-2004 , 15:12  
Reply With Quote #3

have you seen amx_holyslap or amx_uberslap

its funny.
__________________
Looking for friends!!!

http://Ms-Proxy.Com Join the fun!
FroXeN is offline
Send a message via ICQ to FroXeN
Burnzy
Veteran Member
Join Date: Apr 2004
Old 07-05-2004 , 15:18  
Reply With Quote #4

ive seen uberslap... id like to see a slap that makes u glow a color, then slaps u 99 times (each with 1 damage), and then (RIGHT AFTER) makes u a rocket and u fly!!!!! (and die)

Now thats a slap!
__________________
Burnzy is offline
Send a message via AIM to Burnzy
Nick
Senior Member
Join Date: Apr 2004
Location: Canada, Alberta, Cal
Old 07-05-2004 , 18:18  
Reply With Quote #5

ty very much Ryan, I will try your code then test it out.
__________________
Nick is offline
Send a message via MSN to Nick
Nick
Senior Member
Join Date: Apr 2004
Location: Canada, Alberta, Cal
Old 07-05-2004 , 18:42  
Reply With Quote #6

Tested it worked like a charm.
__________________
Nick is offline
Send a message via MSN to Nick
Ryan
Senior Member
Join Date: May 2004
Location: NH, USA
Old 07-05-2004 , 23:32  
Reply With Quote #7

__________________
Warcraft 3: Expansion
Homepage | Downloads | Forums
Ryan is offline
Send a message via AIM to Ryan
Nick
Senior Member
Join Date: Apr 2004
Location: Canada, Alberta, Cal
Old 07-06-2004 , 22:09  
Reply With Quote #8

this by any chance cause lots of lag and could crash server like on a 32 player?
__________________
Nick is offline
Send a message via MSN to Nick
Ryan
Senior Member
Join Date: May 2004
Location: NH, USA
Old 07-06-2004 , 23:48  
Reply With Quote #9

no, because it does it's thing, then stops. if you're running milisecond tasks all the time to check for stuff, ie- with potential that they may not even stop, then yes, you're going to lag the hell out of any server. but this code, no.
__________________
Warcraft 3: Expansion
Homepage | Downloads | Forums
Ryan is offline
Send a message via AIM to Ryan
Nick
Senior Member
Join Date: Apr 2004
Location: Canada, Alberta, Cal
Old 07-07-2004 , 02:11  
Reply With Quote #10

ok good I was thinking it might cause some lag.
__________________
Nick is offline
Send a message via MSN to Nick
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 14:45.


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