Jump to content

AMX Scripting


Recommended Posts

OK, scripting is VERY new to me. I don't know C or C++ or anything, I'm just trying to look at other source code and figure this stuff out. I'm trying to add to a restartround script, all I want it to do is say "GL HF --- Live Live Live!!!" after the restarts. So I have added the last couple of lines just by looking through some other scripts on the amx website. When I try to compile I get two tag mismatch warnings....bearing in mind I really have no clue, can you point out my mistakes?

 

public display() {

set_hudmessage(200, 0, 0, -1.0, 0.32, 0, 2, 12, 0.1, 0.2, 4)

show_hudmessage(0, "GL HF --- LIVE LIVE LIVE!!!")

return PLUGIN_CONTINUE

}

 

thanks

bubble

Link to comment
Share on other sites

/* AMXMOD script.

*

* © Copyright 2000-2002, Thx to FF117bomb hu made amx_match which i used to lern from Zakspeed

* This file is provided as is (no warranties).

*

*/  

 

#include <amxmod>

 

public admin_treerestarts(id)

{

   set_hudmessage(0, 200, 0, -1.0, 0.40, 0, 6.0, 6.0, 0.1, 0.1, 9)

   show_hudmessage(0,"* 3 Restarts and we are LIVE *")

   new mapname[32]   get_mapname(mapname,32)

   set_cvar_string("amx_nextmap" ,mapname)

   rround("2")  

   set_task(2.0, "rround",0,"2",2)  

   set_task(4.0, "rround",0,"4",2)  

   set_task(10.0, "lrestart",0)

}

 

public rround(time[])

{

   server_cmd(" sv_restartround %s",time)

   return PLUGIN_CONTINUE

}

 

public lrestart()

{

   set_hudmessage(0, 200, 0, -1.0, 0.40, 0, 6.0, 6.0, 0.1, 0.1, 9)

   show_hudmessage(0,"* Game is now LIVE ! GL & HF *")

   return PLUGIN_CONTINUE

}

 

public plugin_init()

{

   register_plugin("AMX RESTART GAME","0.2","zakspeed")  

   register_clcmd("admin_restartgame","admin_treerestarts",ADMIN_LEVEL_A,"admin_restartgame - Restarts Server 3 times")

   return PLUGIN_CONTINUE

}

 

This is the script from 'Restart 3 Times and Go' on the amxmod website. You could just edit the "Game is now live" language to say what you want. Also, you might want to change 'admin_restartgame' in the last coupla lines to something like 'amx_lo3', to make it shorter to type. Then just compile with SC. I've gotten this to work that way.

 

Hope this helps

Link to comment
Share on other sites

Technically... tag mismatch means the compiler thinks you've passed a parameter of the incorrect type vs its definition (include file). In this case it thinks you are passing a fixed number (integer) type as opposed of a float type (decimal).

 

native set_hudmessage(red=200, green=100, blue=0, Float:x=-1.0, Float:y=0.35, effects=0, Float:fxtime=6.0, Float:holdtime=12.0, Float:fadeintime=0.1, Float:fadeouttime=0.2,channel=4);

 

[doesn't work]

set_hudmessage(200, 0, 0, -1.0, 0.35, 0, 2, 12, 0.1, 0.2, 4)

 

[works]

set_hudmessage(200, 0, 0, -1.0, 0.35, 0, 2.0, 12.0, 0.1, 0.2, 4)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...