03.07.2012, 13:38
(
Last edited by rfksna; 08/07/2012 at 11:31 PM.
)
So yeah.. as title says.. you can make your own gamemodes in PHP
I was thinking that maybe someone here might want this so i posted it.
The build may have some bugs as it is untested.
Currently supported functions are the ones from:
a_samp.inc (0.3e)
a_players.inc (0.3e)
a_vehicles.inc (0.3e)
a_objects.inc (0.3e)
- MySQL is enabled in PHP. You can use these functions http://www.php.net/manual/en/ref.mysql.php
- Added $_SAMP superglobal variable. An example is that you can store the players info in $_SAMP['players'][].. and you don't need to declare it as global in each function or callback that you want to use.
So how does it work?
* This is basically a plugin (plugins\phsamp.dll) that uses php (php5ts.dll) and its extension (php_plugin.dll) to call functions from samp.
* The archive contains a folder "_phps" and the main script that gets executed when you start the server is "nxmain.php"
* Logs are saved in "_phps/php_errors.log" but you can change that in php.ini
* When creating gamemodes you do not need to restart the server or reload the filterscript. You can just type "/rr" and the php will be reloaded (_phps/nxmain.php). Look into the filterscript source for more details.
Download for PHSAMP
Download for PHSAMP source
Notice that this is the first thing that i ever done in c++, so please excuse me for my bad c++ code
I was thinking that maybe someone here might want this so i posted it.
The build may have some bugs as it is untested.
Currently supported functions are the ones from:
a_samp.inc (0.3e)
a_players.inc (0.3e)
a_vehicles.inc (0.3e)
a_objects.inc (0.3e)
- MySQL is enabled in PHP. You can use these functions http://www.php.net/manual/en/ref.mysql.php
- Added $_SAMP superglobal variable. An example is that you can store the players info in $_SAMP['players'][].. and you don't need to declare it as global in each function or callback that you want to use.
So how does it work?
* This is basically a plugin (plugins\phsamp.dll) that uses php (php5ts.dll) and its extension (php_plugin.dll) to call functions from samp.
* The archive contains a folder "_phps" and the main script that gets executed when you start the server is "nxmain.php"
* Logs are saved in "_phps/php_errors.log" but you can change that in php.ini
* When creating gamemodes you do not need to restart the server or reload the filterscript. You can just type "/rr" and the php will be reloaded (_phps/nxmain.php). Look into the filterscript source for more details.
Download for PHSAMP
Download for PHSAMP source
Notice that this is the first thing that i ever done in c++, so please excuse me for my bad c++ code