The online racing simulator
Searching in All forums
(14 results)
TRUCKER LTU
Demo licensed
Any ideas?
Police system idea
TRUCKER LTU
Demo licensed
Hello. I am creating Police system, but I stuck in it. I has been browsing in cruise mod source code's, but I found only simple police system, when around 250 meters, system found one player, which is closier to cop, and it will display one button with player. But I want create system, where I will get list of all players around 250 meters from cop, and on button click - start to chase player. I can create it with programming, but I didn't know principle of this system. I have tried with cicle for, while, but it didn't give benefit. So, can anyone tell this system principle, how it works?
P.S Sorry for my bad english.
TRUCKER LTU
Demo licensed
Thank you, now it is working
But not all functions
When I create button, and click on that button, I get an error:

PHP WARNING:
call_user_func_array() expects parameter 2 to be array, null given in xxxx\modules\prism_button.php on line 52
1 :: call_user_func_array in xxxxmodules\prism_button.php:52
2 :: click in xxxx\modules\prism_buttonmanager.php:152
3 :: onButtonClick in xxxx\modules\prism_statehandler.php:123
4 :: onButtonClick in xxxx\modules\prism_statehandler.php:61
5 :: dispatchPacket in xxxx\modules\prism_hosts.php:576
6 :: inspectPacket in xxxx\modules\prism_hosts.php:487
7 :: handlePacket in xxxx\modules\prism_hosts.php:353
8 :: checkTraffic in xxxx\PHPInSimMod.php:228

Any ideas?
Last edited by TRUCKER LTU, .
TRUCKER LTU
Demo licensed
Quote from cargame.nl :You are doing nothing wrong, couldn't see anything wrong but to make absolutely sure I tested your code a moment ago and it should work as you expect it to be. It creates a button on my screen with Clickme when I type komanda and when clicked the hosts responds with "Clicked a button!" in public chat (with 31 people connected )

So something else is going on, you are sure it's using the host $ucid ? Debug with echo $ucid and;


if (($clients = $this->getHostState($hostID)->clients) && $clients !== NULL)
{
var_dump($clients);
}

to check what UCIDs actually are assigned.

When I wrote your code to my script, I got this:
Loaded cvars.ini
Loaded hosts.ini
Loaded http.ini
Listening for http requests on 127.0.0.1:80
Loaded telnet.ini
Loaded admins.ini
Loaded plugins.ini
Loading plugins
Loading plugin: admin
Loading plugin: welcome
2 Plugins Loaded.
Connecting to 192.168.0.30:29999 ... #1
Connected to 192.168.0.30:29999
< IS_VER Packet from Cruise.
> TINY_ISM Packet to Cruise.
> TINY_SST Packet to Cruise.
> TINY_NCN Packet to Cruise.
> TINY_NPL Packet to Cruise.
> TINY_RES Packet to Cruise.
> TINY_GTH Packet to Cruise.
> TINY_SCP Packet to Cruise.
> TINY_REO Packet to Cruise.
> TINY_RST Packet to Cruise.
> TINY_AXI Packet to Cruise.
> TINY_NLP Packet to Cruise.
> TINY_MCI Packet to Cruise.
> TINY_RIP Packet to Cruise.
< IS_ISM Packet from Cruise.
> TINY_NCN Packet to Cruise.
> TINY_NPL Packet to Cruise.
> TINY_RES Packet to Cruise.
< IS_STA Packet from Cruise.
< IS_NCN Packet from Cruise.
< SMALL_RTP Packet from Cruise.
< IS_REO Packet from Cruise.
< IS_RST Packet from Cruise.
< IS_AXI Packet from Cruise.
< IS_RIP Packet from Cruise.
< IS_NCN Packet from Cruise.
< IS_MSO Packet from Cruise.
< IS_NCN Packet from Cruise.
< IS_STA Packet from Cruise.
< IS_MSO Packet from Cruise.
> IS_BTN Packet to Cruise.
array(2) {
[0]=>
object(ClientHandler)#14 (9) {
["players"]=>
array(0) {
}
["UCID":protected]=>
int(0)
["UName":protected]=>
string(0) ""
["PName":protected]=>
string(4) "host"
["Admin":protected]=>
int(1)
["Total":protected]=>
int(1)
["Flags":protected]=>
int(0)
["parent"]=>
object(StateHandler)#12 (47) {
["handles":protected]=>
array(25) {
[1]=>
string(11) "onInSimInit"
[2]=>
string(9) "onVersion"
[3]=>
string(6) "onTiny"
[4]=>
string(7) "onSmall"
[5]=>
string(13) "onStateChange"
[9]=>
string(22) "onCameraPosisionChange"
[10]=>
string(18) "onMultiPlayerStart"
[17]=>
string(11) "onRaceStart"
[36]=>
string(9) "onReorder"
[37]=>
string(15) "onNodeLapPlayer"
[38]=>
string(14) "onMultiCarInfo"
[43]=>
string(11) "onAutoXInfo"
[48]=>
string(19) "onReplayInformation"
[18]=>
string(14) "onClientPacket"
[19]=>
string(14) "onClientPacket"
[20]=>
string(14) "onClientPacket"
[21]=>
string(14) "onPlayerPacket"
[22]=>
string(14) "onPlayerPacket"
[23]=>
string(14) "onPlayerPacket"
[34]=>
string(14) "onPlayerPacket"
[35]=>
string(14) "onPlayerPacket"
[31]=>
array(2) {
[0]=>
string(14) "onClientPacket"
[1]=>
string(14) "onPlayerPacket"
}
[42]=>
string(16) "onButtonFunction"
[46]=>
string(13) "onButtonClick"
[47]=>
string(12) "onButtonText"
}
["clients"]=>
*RECURSION*
["players"]=>
array(0) {
}
["Version":protected]=>
NULL
["Product":protected]=>
NULL
["InSimVer":protected]=>
NULL
["ReplaySpeed":protected]=>
float(1)
["State":protected]=>
int(2560)
["InGameCam":protected]=>
int(0)
["ViewPLID":protected]=>
int(0)
["NumP":protected]=>
int(0)
["NumConns":protected]=>
int(2)
["NumFinished":protected]=>
int(0)
["RaceInProg":protected]=>
int(0)
["QualMins":protected]=>
int(0)
["RaceLaps":protected]=>
int(0)
["Track":protected]=>
string(3) "BL1"
["Weather":protected]=>
int(2)
["Wind":protected]=>
int(0)
["Pos":protected]=>
NULL
["Heading":protected]=>
NULL
["Pitch":protected]=>
NULL
["Roll":protected]=>
NULL
["FOV":protected]=>
NULL
["Time":protected]=>
NULL
["Host"]=>
int(1)
["HName"]=>
string(12) "^2Test server"
["Flags"]=>
int(544)
["NumNodes"]=>
int(323)
["Finish"]=>
int(301)
["Split1"]=>
int(86)
["Split2"]=>
int(213)
["Split3"]=>
int(65535)
["Info":protected]=>
NULL
["NumC":protected]=>
NULL
["AXStart":protected]=>
int(0)
["NumCP":protected]=>
int(0)
["NumO":protected]=>
int(0)
["LName":protected]=>
string(0) ""
["Error":protected]=>
int(2)
["MPR":protected]=>
int(0)
["Paused":protected]=>
int(0)
["Options":protected]=>
int(0)
["CTime":protected]=>
int(0)
["TTime":protected]=>
int(0)
["RName":protected]=>
string(0) ""
["PLID"]=>
array(0) {
}
}
["PRISM"]=>
bool(false)
}
[1]=>
object(ClientHandler)#13 (9) {
["players"]=>
array(0) {
}
["UCID":protected]=>
int(1)
["UName":protected]=>
string(11) "TRUCKER LTU"
["PName":protected]=>
string(9) "^1Trucker"
["Admin":protected]=>
int(1)
["Total":protected]=>
int(2)
["Flags":protected]=>
int(4)
["parent"]=>
object(StateHandler)#12 (47) {
["handles":protected]=>
array(25) {
[1]=>
string(11) "onInSimInit"
[2]=>
string(9) "onVersion"
[3]=>
string(6) "onTiny"
[4]=>
string(7) "onSmall"
[5]=>
string(13) "onStateChange"
[9]=>
string(22) "onCameraPosisionChange"
[10]=>
string(18) "onMultiPlayerStart"
[17]=>
string(11) "onRaceStart"
[36]=>
string(9) "onReorder"
[37]=>
string(15) "onNodeLapPlayer"
[38]=>
string(14) "onMultiCarInfo"
[43]=>
string(11) "onAutoXInfo"
[48]=>
string(19) "onReplayInformation"
[18]=>
string(14) "onClientPacket"
[19]=>
string(14) "onClientPacket"
[20]=>
string(14) "onClientPacket"
[21]=>
string(14) "onPlayerPacket"
[22]=>
string(14) "onPlayerPacket"
[23]=>
string(14) "onPlayerPacket"
[34]=>
string(14) "onPlayerPacket"
[35]=>
string(14) "onPlayerPacket"
[31]=>
array(2) {
[0]=>
string(14) "onClientPacket"
[1]=>
string(14) "onPlayerPacket"
}
[42]=>
string(16) "onButtonFunction"
[46]=>
string(13) "onButtonClick"
[47]=>
string(12) "onButtonText"
}
["clients"]=>
*RECURSION*
["players"]=>
array(0) {
}
["Version":protected]=>
NULL
["Product":protected]=>
NULL
["InSimVer":protected]=>
NULL
["ReplaySpeed":protected]=>
float(1)
["State":protected]=>
int(2560)
["InGameCam":protected]=>
int(0)
["ViewPLID":protected]=>
int(0)
["NumP":protected]=>
int(0)
["NumConns":protected]=>
int(2)
["NumFinished":protected]=>
int(0)
["RaceInProg":protected]=>
int(0)
["QualMins":protected]=>
int(0)
["RaceLaps":protected]=>
int(0)
["Track":protected]=>
string(3) "BL1"
["Weather":protected]=>
int(2)
["Wind":protected]=>
int(0)
["Pos":protected]=>
NULL
["Heading":protected]=>
NULL
["Pitch":protected]=>
NULL
["Roll":protected]=>
NULL
["FOV":protected]=>
NULL
["Time":protected]=>
NULL
["Host"]=>
int(1)
["HName"]=>
string(12) "^2Test server"
["Flags"]=>
int(544)
["NumNodes"]=>
int(323)
["Finish"]=>
int(301)
["Split1"]=>
int(86)
["Split2"]=>
int(213)
["Split3"]=>
int(65535)
["Info":protected]=>
NULL
["NumC":protected]=>
NULL
["AXStart":protected]=>
int(0)
["NumCP":protected]=>
int(0)
["NumO":protected]=>
int(0)
["LName":protected]=>
string(0) ""
["Error":protected]=>
int(2)
["MPR":protected]=>
int(0)
["Paused":protected]=>
int(0)
["Options":protected]=>
int(0)
["CTime":protected]=>
int(0)
["TTime":protected]=>
int(0)
["RName":protected]=>
string(0) ""
["PLID"]=>
array(0) {
}
}
["PRISM"]=>
array(3) {
["accessFlags"]=>
int(2528454)
["connection"]=>
string(6) "Cruise"
["temporary"]=>
bool(true)
}
}
}

Quote from Dygear :Or it could be that the settings are only making the buttons local. I'm pretty sure it's a flag in the ISP_ISI packet.

If your running a host that is also the client in the game, you might be tripping over the ISF_LOCAL flag.

I host with DEDI, if you have this in mind. I think, that defined settings is bad.
How can I define flags in ISP_ISI packet on PRISM?
TRUCKER LTU
Demo licensed
I will post my code:
class welcome extends Plugins
{
const URL = 'http://lfsforum.net/forumdisplay.php?f=312';
const NAME = 'Welcome & MOTD';
const AUTHOR = 'PRISM Dev Team';
const VERSION = PHPInSimMod::VERSION;
const DESCRIPTION = 'Welcome messages for clients, and Message of the Day (MOTD)';

public function __construct()
{
$this->registerPacket('onPrismConnect', ISP_VER);
$this->registerPacket('onClientConnect', ISP_NCN);
$this->registerSayCommand('komanda', 'cmdTestas', 'Information about the triggers purpose goes here.');
}

public function onPrismConnect(IS_VER $VER)
{
IS_MSX()->Msg('PRISM Version ^3'.PHPInSimMod::VERSION.'^8 Has Connected.')->Send();
}

public function onClientConnect(IS_NCN $NCN)
{
$MTC = IS_MTC()->Sound(SND_SYSMESSAGE)->UCID($NCN->UCID);
$MTC->Text('^1Hello :)')->Send();
}
public function cmdTestas($cmd, $ucid)
{
global $PRISM;
$btn_close = new Button($ucid, 'testbtn', 'test');
$btn_close->Text('Click me');
$btn_close->L(120)->T(40)->W(20)->H(20)->BStyle = ISB_CLICK;
$btn_close->registerOnClick($this, 'click');
$btn_close->send();

return PLUGIN_HANDLED;
}
public function click()
{
IS_MSX()->Msg('Clicked a button!')->Send();
}
}

What I am doing wrong?
Creating Button to players error
TRUCKER LTU
Demo licensed
Hello. I am scripting PRISM for fun, and there is failure when I am creating a button. When I create a button, ant write user's UCID, the button is displaying to host, not to player. I am using PRISM 0.4.4 . Does anyone know fix of this bug?
TRUCKER LTU
Demo licensed
Hello. Can anyone write an example of creating and using button, where after pressed need to enter text. InSim packet called IS_BTT, to get what user was writing.
EDIT: I created it myself, using InsimDotNET source code. That's the code for someone, who needs or in future need code:

insim.Send(new IS_BTN { Text = "Your text", BStyle = ButtonStyles.ISB_CLICK | ButtonStyles.ISB_LIGHT, UCID = C.UCID, H = 6, W = 30, T = 30, L = 80, ClickID = 6, ReqI = 6, Caption = "Text when pressed", TypeIn = 10});

Caption is text, which is written when user click the button. TypeIn is max symbols, which can be written in box.
Last edited by TRUCKER LTU, .
TRUCKER LTU
Demo licensed
Can you post for us this cruise mod source code?
TRUCKER LTU
Demo licensed
Because I want to log racers joining, when they are crashed to other players etc. If Player is a cheater, it will be easier to report him.
LFS External - Get user ip
TRUCKER LTU
Demo licensed
Hello. Is there any flag or script, to get connected user ip to InSim server? I want to do logs, and I need connected user Ip address. Can anyone help with this question?
TRUCKER LTU
Demo licensed
I have 2 accounts - with one I am racing in DEMO, but forgot password and email was locked So I found older one, why 3 posts? Because I rarely come to this forum, and earlier I haven't got any questions. Now just learning C# InSim programming.
TRUCKER LTU
Demo licensed
I am creating cruise server just for DEMO I will buy S2 when I have enough cash to it
TRUCKER LTU
Demo licensed
I searched. But anyway, I didn't found it. Just threads, where people are trying to do it.
LFS External with IS_PLC packet
TRUCKER LTU
Demo licensed
Hello. Can someone send me LFS External with IS_PLC packet? I tried to do it myself, but failed.
FGED GREDG RDFGDR GSFDG