TIGS98 Posted June 5, 2015 Share Posted June 5, 2015 Every quit / login script will ask pro link to update the amount of online players addEventHandler ( "onPlayerQuit", root, function ( ) callRemote ( "http://www.website.com/mtasdk/refreshdata.php" ) end ) addEventHandler ( "onPlayerJoin", root, function ( ) callRemote ( "http://www.website.com/mtasdk/refreshdata.php" ) end ) that is, it will not send or receive data, but make a connection with the link and this link performs every operation Link to comment
xXMADEXx Posted June 5, 2015 Share Posted June 5, 2015 You're not using callRemote correctly. Try using this: callRemote ( "http://www.website.com/mtasdk/refreshdata.php", getElementsByType ( "player" ) ) Also, please post your PHP code. Link to comment
mommytellme Posted June 5, 2015 Share Posted June 5, 2015 xXMADEXx said: You're not using callRemote correctly. Try using this: callRemote ( "http://www.website.com/mtasdk/refreshdata.php", getElementsByType ( "player" ) ) Also, please post your PHP code. getElementsByType returns table so: callRemote ( "http://www.website.com/mtasdk/refreshdata.php", #getElementsByType ( "player" ) ) is the correct form Link to comment
TIGS98 Posted June 5, 2015 Author Share Posted June 5, 2015 are variables that come from server.php file that is synchronized with a script on the server via SDK refreshdata.php <?php include( "server.php" ); ?><?php include( "configurations.php" ); ?> <?php// $teamcr $teampo $teamci $teamad $online $slot ( server.php )$criminososcount = count ($teamcr); $policiaiscount = count ($teampo); $cidadaocount = count ($teamci);$administradorcout = count ($teamad); // mysql connection ( configurations.php )mysql_select_db("vdbg_servidor", $conecta) or print(mysql_error()); $sql = "UPDATE serverstatus SET online='".$online."', slots='".$slot."', criminososcount='".$criminososcount."', policiaiscount='".$policiaiscount."', cidadaocount='".$cidadaocount."', administradorcout='".$administradorcout."' WHERE id=0"; mysql_query($sql);mysql_close(); ?> Link to comment
xXMADEXx Posted June 5, 2015 Share Posted June 5, 2015 ~TIGS98 said: are variables that come from server.php file that is synchronized with a script on the server via SDKrefreshdata.php <?php include( "server.php" ); ?><?php include( "configurations.php" ); ?> <?php// $teamcr $teampo $teamci $teamad $online $slot ( server.php )$criminososcount = count ($teamcr); $policiaiscount = count ($teampo); $cidadaocount = count ($teamci);$administradorcout = count ($teamad); // mysql connection ( configurations.php )mysql_select_db("vdbg_servidor", $conecta) or print(mysql_error()); $sql = "UPDATE serverstatus SET online='".$online."', slots='".$slot."', criminososcount='".$criminososcount."', policiaiscount='".$policiaiscount."', cidadaocount='".$cidadaocount."', administradorcout='".$administradorcout."' WHERE id=0"; mysql_query($sql);mysql_close(); ?> Honestly, I don't see why you just don't use the MTA SQL functions, it would be so much more efficient. Link to comment
TIGS98 Posted June 7, 2015 Author Share Posted June 7, 2015 Well, I can work better using php, since I know the functions. Well, help me redo the count of items in the table using the "count" of the moon php .. example: function test() local test = { abc, def, ghi, jkl } local num = count(test) return num end I'm not good at Moon script more I think you will understand, the result has to give 4 ( abc = 1 def = 1 ghi = 1 jkl = 1 ) = 4 Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now