Jump to content

callRemote


TIGS98

Recommended Posts

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
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

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
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();  ?>  

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

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

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...