AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Passing on a string/num/float to after a mapchange (https://forums.alliedmods.net/showthread.php?t=50470)

Ramono 01-27-2007 05:53

Passing on a string/num/float to after a mapchange
 
Ive been thinking of this several times, and now i need it but i have no idea how to do it.

How to hold a string/num/float in a mapchange.
The only idea i have is read/write_file but this isnt a good solution.

Maybe this can be a nice idea for a function REQ if it isnt already there?

Thanks,
Ramon

schnitzelmaker 01-27-2007 05:57

Re: Passing on a string/num/float to after a mapchange
 
A better way is using CVARs to store it over Mapchange.

Edit:You can also store more than 1 Information in CVAR or localinfo by using spaces between the infos and parse them.

MaximusBrood 01-27-2007 06:20

Re: Passing on a string/num/float to after a mapchange
 
You could use set_localinfo() and get_localinfo.
Note that the information will be lost on server exit or crash.

Ramono 01-27-2007 11:24

Re: Passing on a string/num/float to after a mapchange
 
For example this:
Code:
#include <amxmodx> public plugin_init() {     register_plugin("Mapchanges","1.00","NL)Ramon(NL")     if(cvar_exists("mymapchanges"))     {         set_cvar_num("mymapchanges",get_cvar_num("mymapchanges") + 1) // map just changed     }     else     {         register_cvar("mymapchanges","0") // first start     }     register_concmd("mapchanges","getmapchanges") } public getmapchanges() {     new message[120]     format(message,119,"This server had %d mapchanges since last restart.",get_cvar_num("mymapchanges"))     server_print(message)     client_print(0,print_chat,message) }

It should work right?

Edit: It does work!

MaximusBrood 01-27-2007 15:24

Re: Passing on a string/num/float to after a mapchange
 
Cvars aren't made for this.

schnitzelmaker 01-27-2007 15:52

Re: Passing on a string/num/float to after a mapchange
 
You can use many things for something who not made for it.:mrgreen:
Its only recommend that it work.

MaximusBrood 01-27-2007 17:23

Re: Passing on a string/num/float to after a mapchange
 
Quote:

Originally Posted by schnitzelmaker (Post 432353)
You can use many things for something who not made for it.:mrgreen:
Its only recommend that it work.

Absolutely not. You forget security, many people do.


All times are GMT -4. The time now is 22:25.

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