Jump to content

x][ مساعدة ][ PHP SDK


Recommended Posts

السلام عليكم

شباب انا حاولت اسوي عدد الاعبين يجي في صفحة php

بس ما ضبط معي

محالوتي

<?php 

	require( "mta_sdk.php" );
	$mtaServer = new mta("192.168.8.105:22003", 22003 , "***" , "***");
	$resource = $mtaServer->getResource ( "getPlayers" );
	$retn = $resource->call ( "getPlayerCount" );
	echo $input[0];
?>

Lua

function getPlayerCount ( )
	outputChatBox ( "There are now " .. getPlayerCount() .. " players on this server!" )
end
addEventHandler ( "onPlayerJoin", getRootElement(), getPlayerCount )
addEventHandler ( "onPlayerQuit", getRootElement(), getPlayerCount )

 

Edited by salh
Link to comment
10 hours ago, salh said:

السلام عليكم

شباب انا حاولت اسوي عدد الاعبين يجي في صفحة php

بس ما ضبط معي

محالوتي


<?php 

	require( "mta_sdk.php" );
	$mtaServer = new mta("192.168.8.105:22003", 22003 , "***" , "***");
	$resource = $mtaServer->getResource ( "getPlayers" );
	$retn = $resource->call ( "getPlayerCount" );
	echo $input[0];
?>

Lua


function getPlayerCount ( )
	outputChatBox ( "There are now " .. getPlayerCount() .. " players on this server!" )
end
addEventHandler ( "onPlayerJoin", getRootElement(), getPlayerCount )
addEventHandler ( "onPlayerQuit", getRootElement(), getPlayerCount )

 

PHP

<?php 

	require( "mta_sdk.php" );
	$mtaServer = new mta("192.168.8.105:22003", 22003 , "***" , "***");
	$resource = $mtaServer->getResource ( "getPlayers" );
	$retn = $resource->call ( "countServerPlayers" );
	echo $retn[0];
?>

Server

function countServerPlayers ( )
    return getPlayerCount()
end

لاتنسى تسوي اكسبورت للفنكشن countServerPlayers

Link to comment
4 hours ago, Simple. said:

PHP


<?php 

	require( "mta_sdk.php" );
	$mtaServer = new mta("192.168.8.105:22003", 22003 , "***" , "***");
	$resource = $mtaServer->getResource ( "getPlayers" );
	$retn = $resource->call ( "countServerPlayers" );
	echo $retn[0];
?>

Server


function countServerPlayers ( )
    return getPlayerCount()
end

لاتنسى تسوي اكسبورت للفنكشن countServerPlayers

الحين اذا سيرفري محلي وش اكتب في مكان الايبي؟

-- sever
function countServerPlayers ( )
    return getPlayerCount()
end

-- meta

<meta>
<script src="Client.lua" type="client"/>
<script src="Server.lua" type="server"/>

<export function="countServerPlayers" http="true" />
</meta>
  
 -- php
  
 
<html>
<head>
	<title></title>
	<link rel="stylesheet" a href="index.css">
</head>
<body>
<?php 
	echo "";

	require( "mta_sdk.php" );
	$mtaServer = new mta("localhost", 22003 , "account" , "pass");
	$resource = $mtaServer->getResource ( "log" );
	$retn = $resource->call ( "countServerPlayers" );
	echo $retn[0];
?>
</body>
</html>

 

Edited by salh
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...