AlliedModders

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

nightscreem 04-20-2005 16:51

suprise
 
i want to make a suprise plugin and i need a start i made this little code not finsihed but it isn't working i'm new to making plugins i ported some and
can someone tell's me what
Code:
return PLUGIN_CONITNUE return PLUGIN_HANDLED
means and what does this means a little better explained like what does global event do and specified maybe that is my problem
Code:
* "a" - global event. * "b" - specified. * "c" - send only once when repeated to other players. * "d" - call if is send to dead player. * "e" - to alive.
here is my plugin
Code:
#include <amxmodx> #include <fun> #define sv_maxspeed 1000 new kills[33] = {0,...}; new deaths[33] = {0,...}; new Float:speed = 1000 public plugin_init() {     register_plugin("suprise","1.0","Nightscream")     register_event("Kill10","Ksuprise_message","b")     register_event("Death10","Dsuprise","b")         return PLUGIN_CONTINUE } public Ksuprise_message(id) {     if (kills[id] == 9) {         client_print(id, print_chat,"[AMXX]if you kill 1 person without get killed you get a suprise");     } } public Dsuprise(id) {     if ((deaths[id] == 10)&(kills[id] < 10)) {         set_user_maxspeed(id,speed);         client_print(id,print_chat,"[AMXX]you have superspeed for one round");     } }
compiles with no errors 1 warning
Quote:

//AMXXSC compile.exe
// by the AMX Mod X Dev Team


//// suprise.sma
// C:\Documents and Settings\Ward1\Bureaublad\counter-strike\addons\amxmodx\scri
pting\suprise.sma(10) : warning 213: tag mismatch
Quote:

Originally Posted by debug
L 04/20/2005 - 22:52:00: [AMXX] Invalid event (name "Kill10") (plugin "suprise.amxx")
L 04/20/2005 - 22:52:00: [AMXX] Native error in "register_event" on line 12 (file "suprise.sma"


teame06 04-20-2005 16:58

http://forums.alliedmods.net/showthread.php?t=10493

for the return explaination.

nightscreem 04-20-2005 17:00

thx man i get it now
now the plugin
and the flags

teame06 04-20-2005 17:06

register_event("Death10","Dsuprise","b") Are you trying to catch the death event?

Quote:

public Dsuprise(id) {
if ((deaths[id] == 10)&(kills[id] < 10)) {
set_user_maxspeed(id,speed);
client_print(id,print_chat,"[AMXX]you have superspeed for one round");
}
}
let me understand this what your plugin is suppose to do.

So when they have a death it suppose to trigger dsuprise? and if they have deaths equal to 10 and kills is less than 10, they get super speed for one round?


Also you don't need return PLUGIN_CONTINUE in public plugin_init()

nightscreem 04-20-2005 17:15

yes
if death= 10 and there kills are less then 10 they get superspeed for one round and if they have 9 kills it sayes to that player if you kill 1 person without get killed you get a suprise

XxAvalanchexX 04-20-2005 17:27

You completely misunderstand register_event.

The game has certain messages that the server sends to the client, such as Health. The server remembers your health, but the client has to know when to change it. So, the server sends the Health message to the client, the client receives it, and their health is updated on the HUD.

register_event catches these messages, or events, as they come from the server to the client. You can't make up your own like "Kill10" or "Death10".

nightscreem 04-20-2005 17:41

so what should i use then

teame06 04-20-2005 18:17

Code:
#include <amxmodx> #include <fun> #define SUPERSPEED      (1<<0) // 1 #define NINEKILL        (1<<1) // 2 new PlayerFlags[33] new PlayerFrags[33] public plugin_init() {     register_plugin("suprise", "1.0", "Nightscream")     register_logevent("new_round",2,"0=World triggered","1=Round_Start")     set_cvar_num("sv_maxspeed", 1000) } public new_round() {     new maxplayers = get_maxplayers()     new j     for(j=1; j <= maxplayers; j++)     {         new superspeedmsg[64]         new deaths = get_user_deaths(j)         new frags = get_user_frags(j)         format(superspeedmsg, 63, "[AMXX] You have superspeed for one round")         if ((deaths == 10) & (frags < 10))         {                 set_user_maxspeed(j, 1000.0)                 client_print(j ,print_chat, superspeedmsg)             PlayerFlags[j] += SUPERSPEED         }         else if(PlayerFlags[j] & SUPERSPEED)         {             set_user_maxspeed(j, -1.0)             client_print(j, print_chat, "[AMXX] Your SuperSpeed has ended.")             PlayerFlags[j] -= SUPERSPEED         }         if(frags == 9)         {             client_print(j, print_chat, "[AMXX] If you kill 1 person without get killed you get a suprise.")             PlayerFlags[j] += NINEKILL             PlayerFrags[j] += get_user_frags(j)         }         if(PlayerFlags[j] & NINEKILL) //&& PlayerFrags[j] += )         {             if(frags > PlayerFrags[j])             {                 set_user_maxspeed(j, 1000.0)                 client_print(j ,print_chat, superspeedmsg)                 PlayerFlags[j] += SUPERSPEED                 PlayerFlags[j] -= NINEKILL                 PlayerFrags[j] -= 9             }             else if(frags == PlayerFrags[j])             {                 PlayerFlags[j] -= NINEKILL                 PlayerFrags[j] -= 9             }         }     }     return PLUGIN_CONTINUE }

If someone see something wrong, Please feel free to edit it. I believe this should work.

Edited* 5:02pm 4/20/05

nightscreem 04-21-2005 10:12

why looping?
and what do you mean with world triggered and round_start

v3x 04-21-2005 14:10

Quote:

Originally Posted by nightscreem
why looping?
and what do you mean with world triggered and round_start

If you ever looked in console.. It says something like "World triggered. Round Start". Check out register_event() and register_logevent() in the function wiki.


All times are GMT -4. The time now is 09:50.

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