SA-MP Forums Archive
Automatically add to server version define? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Automatically add to server version define? (/showthread.php?tid=424889)



Automatically add to server version define? - Scenario - 24.03.2013

I doubt this is possible through PAWN, but could I make it so every time I save my mode, it automatically adds +1 to the server version's define? I usually forget to update the server version and it would be so much easier if it could do it itself.

I'm using Notepad++, for what it's worth!


Re: Automatically add to server version define? - Glad2BeHere - 24.03.2013

Do u mean everytime u compile it .... u can do it threw a variable every u start the server.... or restart the server or close it..... u can make a variable +1 for that


Re: Automatically add to server version define? - Threshold - 24.03.2013

Yeah maybe not that accurate, but using OnGameModeInit and adding a certain value to a variable and then saving it is as close as you might get. I had this exact same idea and was wondering if it was possible, because it was annoying to constantly change my server.cfg. I was leaning more towards a command for setting the server version, but I wasn't really prepared to try and figure out how to script it to automatically change...


Re: Automatically add to server version define? - Glad2BeHere - 24.03.2013

Benzo Ummm... just put in under GameModeInit.... Or GameModeExit... Like everything the gamemode closed the value ++.... or everytime is starts the value ++... and the value is saved and all is needed a string to be format and problem solved.... just like how u would save any other variable...


Re: Automatically add to server version define? - LarzI - 24.03.2013

Can't you make a batch file (which you'd run to compile instead of directly running pawncc.exe) to write to a file which you then can include?


Re: Automatically add to server version define? - Threshold - 24.03.2013

Yes, but this wouldn't really support server crashes... therefore the version would update even if the server restarts itself...


Re: Automatically add to server version define? - Glad2BeHere - 24.03.2013

Here is how simple...... Make A Cmd:newversion everytime a admin does the variable goes up ++ and everyone is happy....


Re: Automatically add to server version define? - SchurmanCQC - 24.03.2013

Quote:
Originally Posted by Glad2BeHere
Посмотреть сообщение
Here is how simple...... Make A Cmd:newversion everytime a admin does the variable goes up ++ and everyone is happy....
He wants it to be automatic.

Create a batch file and run that in notepad++ using a hotkey. (F5?)

Example:

set /p build= <BUILD.bld :: Set variable %build% to the text in BUILD.bld file
set /a build+=1 :: Add 1 to %build%
echo %build% > BUILD.bld :: Write %build% to BUILD.bld file, and overwrite
:: Execute pawncc.exe here...


NOTE: Untested code... no idea if it will work. I know almost nothing about BATCH.


Re: Automatically add to server version define? - Scenario - 24.03.2013

Schurman, that seems like a logical idea. However, where is this "build.bld" file being made, can I add (f.e) .0001 instead of "1" each time? And, can I use the "version" in the mode?


Re: Automatically add to server version define? - Scenario - 26.03.2013

Still looking for a valid answer to this...