Hello. I wanted to insert server name to servers.txt file. And now I had problem:
LUA:
function result(str)
outputChatBox("#FF8800[TOPTIMES] #FF6565Fetching data...", getRootElement(), 255, 255, 255, true)
if str ~= nil then
if str == "ua" then
outputChatBox("#FF8800[TOPTIMES] #FF6565Your license is not valid! Please, contact GTX#!", getRootElement(), 255, 255, 255, true)
if str == "1" then
outputChatBox("#FF8800[TOPTIMES] #FF6565Data fetched! Welcome!", getRootElement(), 255, 255, 255, true)
if str == "0" then
outputChatBox("#FF8800[TOPTIMES] #FF6565Terminating script...", getRootElement(), 255, 255, 255, true)
outputChatBox("#FF8800[TOPTIMES] #FF6565STEALERS ARE NOT WELCOME!", getRootElement(), 255, 255, 255, true)
outputChatBox("#FF8800[TOPTIMES] #FF6565PLEASE, RE-LICENSE THIS BY ASKING GTX#!", getRootElement(), 255, 255, 255, true)
stopResource(getThisResource())
end
end
end
end
end
function check_license()
--outputChatBox"sending"
callRemote("http://128.204.203.114/mta/toptimes_protection.php", result, getServerName())
--outputChatBox(getServerName())
--outputChatBox"sent"
end
addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), check_license)
PHP (SDK):
<?php
include("sdk/mta_sdk.php");
$table = mta::getInput();
$text = $table[1];
if(isset($text)){
$file = "servers.txt";
$fh = fopen($file, 'a+');
$stringData = $text;
fwrite($fh, $stringData."\n");
fclose($file);
}
$code = "1";
mta::doReturn($code);
?>