AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   code errors (https://forums.alliedmods.net/showthread.php?t=3343)

Nick 07-04-2004 00:06

code errors
 
This is my code
Code:
new slapdmg = (get_cvar_num("sv_slappower"))     new slapnum = (get_cvar_num("sv_numslaps"))     new plist[32],pnum     get_players(plist, pnum ,"a")     for(new i=0; i<pnum; i++)     user_slap(plist,slapdmg,slapnum)     return PLUGIN_HANDLED
I get this error on user_slap(plist,slapdmg,slapnum)

Code:

error 035: argument type mismatch <argument 1>
Any suggestions?

PM 07-04-2004 06:06

Code:
native user_slap(index,power,rnddir=1);

-> change
Code:
user_slap(plist,slapdmg,slapnum)
to
Code:
user_slap(plist[i],slapdmg,slapnum)

but i guess you don't want to pass the slapnum variable to the rnddir param, which should specify whether he should be slapped in a random direction or in a direction based on where he is looking..

Nick 07-04-2004 17:08

Thanks I'll try it, good help :)

Downtown1 07-04-2004 17:13

Code:
new slapdmg = (get_cvar_num("sv_slappower"))     new slapnum = (get_cvar_num("sv_numslaps"))     new plist[32],pnum     get_players(plist, pnum ,"a")     for(new i=0; i<pnum; i++)     for(new j = 0; j < slapnum; j++)     user_slap(plist[i],slapdmg)     return PLUGIN_HANDLED

Try this instead. I'd recommend using a set_task for the slap too, since you probably don't want them to be slapped twice instantenously.

Nick 07-04-2004 17:52

yes I tryed set_task but that gave me tons of runtime errors so I'm tryng user_slap.

Downtown1 07-05-2004 14:03

Well, set task only allows you to pass one parameter array :).

Nick 07-06-2004 18:59

Ryan helped me out alot, using set_task was the right way to go.


All times are GMT -4. The time now is 14:41.

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