25.04.2012, 09:14
Hey,
I want to send variables to php.
So I tried to do this by HTTP and Rcon command.
Here is the filterscript:
And that is the PHP:
When I'm refrashing the PHP page, the sa-mp log is:
And the Php page:
How can I solve that problem? Thanks.
I want to send variables to php.
So I tried to do this by HTTP and Rcon command.
Here is the filterscript:
Код:
// This is a comment // uncomment the line below if you want to write a filterscript //#define FILTERSCRIPT #include <a_samp> #include <a_http> main() { print("\n----------------------------------"); print(" Blank Gamemode by your name here"); print("----------------------------------\n"); } public OnGameModeInit() { // Don't use these lines if it's a filterscript SetGameModeText("Blank Script"); AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0); return 1; } public OnGameModeExit() { return 1; } public OnPlayerRequestClass(playerid, classid) { SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746); SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746); SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746); return 1; } public OnPlayerConnect(playerid) { return 1; } public OnPlayerDisconnect(playerid, reason) { return 1; } public OnPlayerSpawn(playerid) { return 1; } public OnPlayerDeath(playerid, killerid, reason) { return 1; } public OnVehicleSpawn(vehicleid) { return 1; } public OnVehicleDeath(vehicleid, killerid) { return 1; } public OnPlayerText(playerid, text[]) { return 1; } public OnPlayerCommandText(playerid, cmdtext[]) { if (strcmp("/mycommand", cmdtext, true, 10) == 0) { // Do something here return 1; } return 0; } public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger) { return 1; } public OnPlayerExitVehicle(playerid, vehicleid) { return 1; } public OnPlayerStateChange(playerid, newstate, oldstate) { return 1; } public OnPlayerEnterCheckpoint(playerid) { return 1; } public OnPlayerLeaveCheckpoint(playerid) { return 1; } public OnPlayerEnterRaceCheckpoint(playerid) { return 1; } public OnPlayerLeaveRaceCheckpoint(playerid) { return 1; } public OnRconCommand(cmd[]) { if(!strcmp(cmd,"test_num",true)) { return HTTP(0, HTTP_POST, "localhost/testve.php", "TNum=4", "MyHttpResponse"); /*SendClientMessageToAll(0xFFFFFFAA,"Hello World!"); print("You said hello to the world.");// This will appear to the player who typed the rcon command in the chat in white return 1;*/ } return 0; } forward MyHttpResponse(index, response_code, data[]); public MyHttpResponse(index, response_code, data[]) { if(response_code == 200) //Did the request succeed? { //Yes! printf("The URL replied: %s", data); return 1; } else { //No! printf("The request failed! The response code was: %d", response_code); return 1; } } public OnPlayerRequestSpawn(playerid) { return 1; } public OnObjectMoved(objectid) { return 1; } public OnPlayerObjectMoved(playerid, objectid) { return 1; } public OnPlayerPickUpPickup(playerid, pickupid) { return 1; } public OnVehicleMod(playerid, vehicleid, componentid) { return 1; } public OnVehiclePaintjob(playerid, vehicleid, paintjobid) { return 1; } public OnVehicleRespray(playerid, vehicleid, color1, color2) { return 1; } public OnPlayerSelectedMenuRow(playerid, row) { return 1; } public OnPlayerExitedMenu(playerid) { return 1; } public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid) { return 1; } public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) { return 1; } public OnRconLoginAttempt(ip[], password[], success) { return 1; } public OnPlayerUpdate(playerid) { return 1; } public OnPlayerStreamIn(playerid, forplayerid) { return 1; } public OnPlayerStreamOut(playerid, forplayerid) { return 1; } public OnVehicleStreamIn(vehicleid, forplayerid) { return 1; } public OnVehicleStreamOut(vehicleid, forplayerid) { return 1; } public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { return 1; } public OnPlayerClickPlayer(playerid, clickedplayerid, source) { return 1; }
PHP код:
<?php
require_once 'SampRconAPI.php';
$rcon = new SampRconAPI('127.0.0.1', 7777, '123');
$rcon->Call('test_num');
if($_REQUEST['TNum'])
echo 'new TestNum = '+ $_REQUEST['TNum'];
else
echo 'failed.';
?>
Quote:
SA-MP Dedicated Server ---------------------- v0.3d-R2, ©2005-2011 SA-MP Team [12:17:07] [12:17:07] Server Plugins [12:17:07] -------------- [12:17:07] Loaded 0 plugins. [12:17:07] [12:17:07] Filterscripts [12:17:07] --------------- [12:17:07] Loading filterscript 'testrcon.amx'... [12:17:07] Loaded 1 filterscripts. [12:17:07] Loaded 3 vehicles from: vehicles/trains.txt [12:17:07] Loaded 3 vehicles from: vehicles/pilots.txt [12:17:07] Loaded 15 vehicles from: vehicles/lv_law.txt [12:17:07] Loaded 39 vehicles from: vehicles/lv_airport.txt [12:17:07] Loaded 255 vehicles from: vehicles/lv_gen.txt [12:17:07] Loaded 38 vehicles from: vehicles/sf_law.txt [12:17:07] Loaded 35 vehicles from: vehicles/sf_airport.txt [12:17:07] Loaded 353 vehicles from: vehicles/sf_gen.txt [12:17:07] Loaded 24 vehicles from: vehicles/ls_law.txt [12:17:07] Loaded 37 vehicles from: vehicles/ls_airport.txt [12:17:07] Loaded 98 vehicles from: vehicles/ls_gen_inner.txt [12:17:07] Loaded 389 vehicles from: vehicles/ls_gen_outer.txt [12:17:07] Loaded 71 vehicles from: vehicles/whetstone.txt [12:17:07] Loaded 168 vehicles from: vehicles/bone.txt [12:17:07] Loaded 61 vehicles from: vehicles/flint.txt [12:17:07] Loaded 96 vehicles from: vehicles/tierra.txt [12:17:07] Loaded 96 vehicles from: vehicles/red_county.txt [12:17:07] Total vehicles from files: 1781 [12:17:07] --------------------------------------- [12:17:07] Running Grand Larceny - by the SA-MP team [12:17:07] --------------------------------------- [12:17:07] Number of vehicle models: 173 [12:17:16] The URL replied: 4 [12:17:16] The URL replied: 4 [12:17:16] The request failed! The response code was: 6 [12:17:16] The URL replied: 4 [12:17:16] The URL replied: 4 [12:17:16] The request failed! The response code was: 6 [12:17:16] The URL replied: 4 [12:17:16] The URL replied: 4 [12:17:16] The request failed! The response code was: 6 [12:17:16] The URL replied: 4 [12:17:16] The request failed! The response code was: 6 [12:17:16] The URL replied: 4 [12:17:16] The request failed! The response code was: 6 [12:17:16] The URL replied: 4 [12:17:16] The request failed! The response code was: 6 [12:17:16] The URL replied: 4 [12:17:16] The URL replied: 4 [12:17:16] The URL replied: 4 [12:17:16] The URL replied: 4 [12:17:16] The URL replied: 4 [12:17:16] The URL replied: 4 [12:17:16] The URL replied: 4 [12:17:16] The URL replied: 4 [12:17:16] The request failed! The response code was: 6 [12:17:16] The URL replied: 4 [12:17:16] The URL replied: 4 [12:17:16] The URL replied: 4 [12:17:16] The request failed! The response code was: 6 [12:17:16] The URL replied: 4 [12:17:16] The request failed! The response code was: 6 [12:17:16] The URL replied: 4 [12:17:16] The request failed! The response code was: 6 [12:17:16] The URL replied: 4 [12:17:16] The URL replied: 4 [12:17:16] The request failed! The response code was: 6 [12:17:16] The URL replied: 4 [12:17:16] The request failed! The response code was: 6 [12:17:16] The URL replied: 4 [12:17:16] The URL replied: 4 [12:17:16] The URL replied: 4 [12:17:16] The request failed! The response code was: 6 [12:17:16] The URL replied: 4 [12:17:16] The URL replied: 4 [12:17:16] The URL replied: 4 [12:17:16] The request failed! The response code was: 6 [12:17:16] The URL replied: 4 [12:17:16] The request failed! The response code was: 6 [12:17:16] The URL replied: 4 [12:17:16] The URL replied: 4 [12:17:16] The request failed! The response code was: 6 [12:17:16] The URL replied: 4 [12:17:16] The request failed! The response code was: 6 [12:17:16] The URL replied: 4 [12:17:16] The request failed! The response code was: 6 [12:17:16] The URL replied: 4 [12:17:16] The URL replied: 4 [12:17:16] The request failed! The response code was: 6 [12:17:16] The URL replied: 4 [12:17:16] The URL replied: 4 [12:17:16] The request failed! The response code was: 6 [12:17:16] The URL replied: 4 [12:17:16] The URL replied: 4 [12:17:16] The URL replied: 4 [12:17:16] The request failed! The response code was: 6 [12:17:16] The URL replied: 4 [12:17:16] The request failed! The response code was: 6 [12:17:16] The URL replied: 4 [12:17:16] The request failed! The response code was: 6 [12:17:16] The URL replied: 4 [12:17:16] The request failed! The response code was: 6 [12:17:16] The URL replied: 4 [12:17:16] The request failed! The response code was: 6 [12:17:16] The URL replied: 4 [12:17:16] The request failed! The response code was: 6 [12:17:16] The URL replied: 4 [12:17:16] The request failed! The response code was: 6 [12:17:16] The URL replied: 4 [12:17:16] The request failed! The response code was: 6 [12:17:16] The URL replied: 4 [12:17:16] The URL replied: 4 [12:17:16] The request failed! The response code was: 6 [12:17:16] The URL replied: 4 [12:17:16] The request failed! The response code was: 6 [12:17:16] The URL replied: 4 [12:17:16] The request failed! The response code was: 6 [12:17:16] The URL replied: 4 [12:17:16] The request failed! The response code was: 6 [12:17:16] The URL replied: 4 [12:17:16] The URL replied: 4 [12:17:16] The request failed! The response code was: 6 [12:17:16] The URL replied: 4 [12:17:16] The request failed! The response code was: 6 [12:17:16] The URL replied: 4 [12:17:16] The request failed! The response code was: 6 [12:17:16] The URL replied: 4 [12:17:16] The request failed! The response code was: 6 [12:17:16] The URL replied: 4 [12:17:16] The URL replied: 4 [12:17:16] The request failed! The response code was: 6 [12:17:16] The URL replied: 4 [12:17:16] The request failed! The response code was: 6 [12:17:18] The URL replied: 4 [12:17:18] The URL replied: 4 [12:17:18] The request failed! The response code was: 6 [12:17:18] The URL replied: 4 [12:17:18] The request failed! The response code was: 6 [12:17:18] The URL replied: 4 [12:17:18] The URL replied: 4 [12:17:18] The URL replied: 4 [12:17:18] The URL replied: 4 [12:17:18] The request failed! The response code was: 6 [12:17:18] The URL replied: 4 [12:17:18] The request failed! The response code was: 6 [12:17:18] The URL replied: 4 [12:17:18] The request failed! The response code was: 6 [12:17:18] The URL replied: 4 [12:17:18] The URL replied: 4 [12:17:18] The URL replied: 4 [12:17:18] The request failed! The response code was: 6 [12:17:18] The URL replied: 4 [12:17:18] The request failed! The response code was: 6 [12:17:18] The URL replied: 4 [12:17:18] The URL replied: 4 [12:17:18] The request failed! The response code was: 6 [12:17:18] The URL replied: 4 [12:17:18] The URL replied: 4 [12:17:18] The request failed! The response code was: 6 [12:17:18] The URL replied: 4 [12:17:18] The request failed! The response code was: 6 [12:17:18] The URL replied: 4 [12:17:18] The request failed! The response code was: 6 [12:17:18] The URL replied: 4 [12:17:18] The request failed! The response code was: 6 [12:17:18] The URL replied: 4 [12:17:18] The request failed! The response code was: 6 [12:17:18] The URL replied: 4 [12:17:18] The URL replied: 4 [12:17:18] The URL replied: 4 [12:17:18] The URL replied: 4 [12:17:18] The request failed! The response code was: 6 [12:17:20] The URL replied: 4 [12:17:20] The URL replied: 4 [12:17:20] The request failed! The response code was: 6 [12:17:20] The URL replied: 4 [12:17:20] The request failed! The response code was: 6 [12:17:20] The URL replied: 4 [12:17:20] The URL replied: 4 [12:17:20] The URL replied: 4 [12:17:20] The request failed! The response code was: 6 [12:17:20] The URL replied: 4 [12:17:20] The request failed! The response code was: 6 [12:17:20] The URL replied: 4 [12:17:20] The URL replied: 4 [12:17:20] The request failed! The response code was: 6 [12:17:20] The URL replied: 4 [12:17:20] The URL replied: 4 [12:17:20] The request failed! The response code was: 6 [12:17:20] The URL replied: 4 [12:17:20] The URL replied: 4 [12:17:20] The URL replied: 4 [12:17:20] The request failed! The response code was: 6 [12:17:20] The URL replied: 4 [12:17:20] The request failed! The response code was: 6 [12:17:20] The URL replied: 4 [12:17:20] The request failed! The response code was: 6 [12:17:20] The URL replied: 4 [12:17:20] The request failed! The response code was: 6 [12:17:20] The URL replied: 4 [12:17:20] The request failed! The response code was: 6 [12:17:20] The URL replied: 4 [12:17:20] The URL replied: 4 [12:17:20] The request failed! The response code was: 6 [12:17:20] The URL replied: 4 [12:17:20] The request failed! The response code was: 6 [12:17:20] The URL replied: 4 [12:17:20] The request failed! The response code was: 6 [12:17:20] The URL replied: 4 [12:17:20] The request failed! The response code was: 6 [12:17:20] The URL replied: 4 [12:17:20] The URL replied: 4 [12:17:20] The URL replied: 4 [12:17:20] The URL replied: 4 [12:17:20] The request failed! The response code was: 6 [12:17:20] The URL replied: 4 [12:17:20] The request failed! The response code was: 6 [12:17:20] The URL replied: 4 [12:17:20] The URL replied: 4 [12:17:20] The request failed! The response code was: 6 [12:17:20] The URL replied: 4 [12:17:20] The request failed! The response code was: 6 [12:17:20] The URL replied: 4 [12:17:20] The request failed! The response code was: 6 [12:17:20] The URL replied: 4 [12:17:20] The request failed! The response code was: 6 [12:17:20] The URL replied: 4 [12:17:20] The request failed! The response code was: 6 [12:17:20] The URL replied: 4 [12:17:20] The URL replied: 4 [12:17:20] The request failed! The response code was: 6 [12:17:20] The URL replied: 4 [12:17:20] The request failed! The response code was: 6 [12:17:20] The URL replied: 4 [12:17:20] The request failed! The response code was: 6 [12:17:20] The URL replied: 4 [12:17:20] The request failed! The response code was: 6 [12:17:20] The URL replied: 4 [12:17:20] The URL replied: 4 [12:17:20] The request failed! The response code was: 6 [12:17:20] The URL replied: 4 [12:17:20] The request failed! The response code was: 6 [12:17:20] The URL replied: 4 [12:17:20] The request failed! The response code was: 6 [12:17:20] The URL replied: 4 [12:17:20] The request failed! The response code was: 6 [12:17:20] The URL replied: 4 [12:17:20] The request failed! The response code was: 6 [12:17:20] The URL replied: 4 [12:17:20] The request failed! The response code was: 6 [12:17:20] The URL replied: 4 [12:17:20] The request failed! The response code was: 6 [12:17:20] The URL replied: 4 [12:17:20] The URL replied: 4 [12:17:22] The URL replied: 4 [12:17:22] The URL replied: 4 [12:17:22] The URL replied: 4 [12:17:22] The request failed! The response code was: 6 [12:17:22] The URL replied: 4 [12:17:22] The request failed! The response code was: 6 [12:17:22] The URL replied: 4 [12:17:22] The request failed! The response code was: 6 [12:17:22] The URL replied: 4 [12:17:22] The request failed! The response code was: 6 [12:17:22] The URL replied: 4 [12:17:22] The request failed! The response code was: 6 [12:17:22] The URL replied: 4 [12:17:22] The URL replied: 4 [12:17:22] The request failed! The response code was: 6 [12:17:22] The URL replied: 4 [12:17:22] The URL replied: 4 [12:17:22] The request failed! The response code was: 6 [12:17:22] The URL replied: 4 [12:17:22] The request failed! The response code was: 6 [12:17:22] The URL replied: 4 [12:17:22] The URL replied: 4 [12:17:22] The request failed! The response code was: 6 [12:17:22] The URL replied: 4 [12:17:22] The request failed! The response code was: 6 [12:17:22] The URL replied: 4 [12:17:22] The URL replied: 4 [12:17:22] The request failed! The response code was: 6 [12:17:22] The URL replied: 4 [12:17:22] The URL replied: 4 [12:17:22] The URL replied: 4 [12:17:22] The request failed! The response code was: 6 [12:17:22] The URL replied: 4 [12:17:22] The request failed! The response code was: 6 [12:17:22] The URL replied: 4 [12:17:22] The request failed! The response code was: 6 [12:17:22] The URL replied: 4 [12:17:22] The request failed! The response code was: 6 [12:17:22] The URL replied: 4 [12:17:22] The request failed! The response code was: 6 [12:17:22] The URL replied: 4 [12:17:22] The URL replied: 4 [12:17:22] The request failed! The response code was: 6 [12:17:22] The URL replied: 4 [12:17:22] The URL replied: 4 [12:17:22] The request failed! The response code was: 6 [12:17:22] The URL replied: 4 [12:17:22] The request failed! The response code was: 6 [12:17:22] The URL replied: 4 [12:17:23] The URL replied: 4 [12:17:24] The URL replied: 4 [12:17:24] The URL replied: 4 [12:17:24] The request failed! The response code was: 6 [12:17:24] The URL replied: 4 [12:17:24] The request failed! The response code was: 6 [12:17:24] The URL replied: 4 [12:17:24] The request failed! The response code was: 6 [12:17:24] The URL replied: 4 [12:17:24] The request failed! The response code was: 6 [12:17:24] The URL replied: 4 [12:17:24] The request failed! The response code was: 6 [12:17:24] The URL replied: 4 [12:17:24] The request failed! The response code was: 6 [12:17:24] The URL replied: 4 [12:17:24] The request failed! The response code was: 6 [12:17:24] The URL replied: 4 [12:17:24] The URL replied: 4 [12:17:24] The URL replied: 4 [12:17:24] The request failed! The response code was: 6 [12:17:24] The URL replied: 4 [12:17:24] The URL replied: 4 [12:17:24] The request failed! The response code was: 6 [12:17:24] The URL replied: 4 [12:17:24] The request failed! The response code was: 6 [12:17:24] The URL replied: 4 [12:17:24] The URL replied: 4 [12:17:24] The URL replied: 4 [12:17:24] The request failed! The response code was: 6 [12:17:24] The URL replied: 4 [12:17:24] The request failed! The response code was: 6 [12:17:24] The URL replied: 4 [12:17:24] The request failed! The response code was: 6 [12:17:24] The URL replied: 4 [12:17:24] The URL replied: 4 [12:17:24] The URL replied: 4 [12:17:24] The request failed! The response code was: 6 [12:17:24] The URL replied: 4 [12:17:24] The URL replied: 4 [12:17:24] The URL replied: 4 [12:17:24] The URL replied: 4 [12:17:24] The request failed! The response code was: 6 [12:17:24] The URL replied: 4 [12:17:24] The URL replied: 4 [12:17:24] The request failed! The response code was: 6 [12:17:24] The URL replied: 4 [12:17:24] The request failed! The response code was: 6 [12:17:24] The URL replied: 4 [12:17:24] The URL replied: 4 [12:17:24] The request failed! The response code was: 6 [12:17:24] The URL replied: 4 [12:17:24] The URL replied: 4 [12:17:24] The request failed! The response code was: 6 [12:17:24] The URL replied: 4 [12:17:24] The request failed! The response code was: 6 [12:17:24] The URL replied: 4 [12:17:24] The URL replied: 4 [12:17:24] The request failed! The response code was: 6 [12:17:24] The URL replied: 4 [12:17:24] The request failed! The response code was: 6 [12:17:24] The URL replied: 4 [12:17:24] The request failed! The response code was: 6 [12:17:24] The URL replied: 4 [12:17:24] The request failed! The response code was: 6 [12:17:24] The URL replied: 4 [12:17:24] The request failed! The response code was: 6 [12:17:24] The URL replied: 4 [12:17:24] The URL replied: 4 [12:17:24] The request failed! The response code was: 6 [12:17:24] The URL replied: 4 [12:17:24] The URL replied: 4 [12:17:24] The request failed! The response code was: 6 [12:17:25] The URL replied: 4 [12:17:26] The URL replied: 4 [12:17:26] The URL replied: 4 [12:17:26] The request failed! The response code was: 6 [12:17:26] The URL replied: 4 [12:17:26] The request failed! The response code was: 6 [12:17:26] The URL replied: 4 [12:17:26] The request failed! The response code was: 6 [12:17:26] The URL replied: 4 [12:17:26] The request failed! The response code was: 6 [12:17:26] The URL replied: 4 [12:17:26] The request failed! The response code was: 6 [12:17:26] The URL replied: 4 [12:17:26] The request failed! The response code was: 6 [12:17:26] The URL replied: 4 [12:17:26] The URL replied: 4 [12:17:26] The URL replied: 4 [12:17:26] The URL replied: 4 [12:17:26] The request failed! The response code was: 6 [12:17:26] The URL replied: 4 [12:17:26] The request failed! The response code was: 6 [12:17:26] The URL replied: 4 [12:17:26] The URL replied: 4 [12:17:26] The request failed! The response code was: 6 [12:17:26] The URL replied: 4 [12:17:26] The request failed! The response code was: 6 [12:17:26] The URL replied: 4 [12:17:26] The request failed! The response code was: 6 [12:17:26] The URL replied: 4 [12:17:26] The request failed! The response code was: 6 [12:17:26] The URL replied: 4 [12:17:26] The URL replied: 4 [12:17:26] The request failed! The response code was: 6 [12:17:26] The URL replied: 4 [12:17:26] The URL replied: 4 [12:17:26] The request failed! The response code was: 6 [12:17:26] The URL replied: 4 [12:17:26] The request failed! The response code was: 6 [12:17:26] The URL replied: 4 [12:17:26] The URL replied: 4 [12:17:26] The request failed! The response code was: 6 [12:17:26] The URL replied: 4 [12:17:26] The request failed! The response code was: 6 [12:17:26] The URL replied: 4 [12:17:26] The request failed! The response code was: 6 [12:17:26] The URL replied: 4 [12:17:26] The URL replied: 4 [12:17:26] The request failed! The response code was: 6 [12:17:26] The URL replied: 4 [12:17:26] The request failed! The response code was: 6 [12:17:26] The URL replied: 4 [12:17:26] The request failed! The response code was: 6 [12:17:26] The URL replied: 4 [12:17:26] The request failed! The response code was: 6 [12:17:26] The URL replied: 4 [12:17:26] The request failed! The response code was: 6 [12:17:26] The URL replied: 4 [12:17:26] The URL replied: 4 [12:17:26] The request failed! The response code was: 6 [12:17:26] The URL replied: 4 [12:17:26] The request failed! The response code was: 6 [12:17:26] The URL replied: 4 [12:17:26] The request failed! The response code was: 6 [12:17:27] The URL replied: 4 [12:17:28] The URL replied: 4 [12:17:28] The URL replied: 4 [12:17:28] The request failed! The response code was: 6 [12:17:28] The URL replied: 4 [12:17:28] The request failed! The response code was: 6 [12:17:28] The URL replied: 4 |
How can I solve that problem? Thanks.