I'm getting an error with the cruise example you so graciously updated
Traceback (most recent call last): File "C:\Python27\lib\asyncore.py", line 79, in read obj.handle_read_event() File "C:\Python27\lib\asyncore.py", line 435, in handle_read_event self.handle_read() File "C:\Python27\lib\site-packages\pyinsim\core.py", line 255, in handle_read self._dispatch_to._handle_tcp(self._recv_buff[:size]) File "C:\Python27\lib\site-packages\pyinsim\core.py", line 462, in _handle_tcp [callback(self, packet) for callback in bound] File "C:/Users/Jonathan/Desktop/Pyinsim New/examples/default cruise.py", line 189, in message_out insim.sendm('^3| ^7Unknown command', ncn.UCID) UnboundLocalError: local variable 'ncn' referenced before assignment Server exiting as no hosts connected
Any time I try to use an ! code, that's what Python tells me. That's from the just the converted script, no modifications.
EDIT: I've moved
ncn = connections[mso.UCID]
from
if cmd in CMD_LOOKUP:
to after
args = mso.Msg[mso.TextStart:].split()
and now I'm just getting unknown command every time, no matter if the code exists or not.
AFAIK, the closest thing to a mod that is allowable is an insim system on a server. You are not allowed to edit the cars, tracks, etc. I do believe that texture mods are allowed for tracks. And custom skins are obviously allowed. But modding cars is not.
It would be amazing if you could port your cruise example from 1.6.4 to 2.0 pretty please I made a half-a**ed attempt at doing so, and it has failed miserably so far.
Edit: Through my various edits, commenting things out, and whatever else I could think of to try to get the code to work, the issue seems to keep on returning to the player management part of the code.
I'm more curious as to why you are a demo user, yet have access to licensed content.
And I'm with Degats on the cheating. It's a driving aid that you otherwise wouldn't have. If this is something you can't do, learn how to, use the mouse, or get a wheel. It was obviously removed for a reason
If I could actually code well, I would do something like this :P However, my coding skills fail. I think Python would be good for this though Very easy to learn language.
You can host a server yourself using the Live For Speed Dedicated Server files.
However I highly doubt you will find anyone who will just rent a live for speed server for you. Even if the LFS Server files are free, hosting them is not. People make businesses out of running game servers, and free servers are no exception.
I've actually been messing around with DarkTimes' cruise script he wrote for Pyinsim. It has a couple neat features I added. I can send it to you if you want (as long as you don't give it to anyone). It's for pyinsim. I haven't finished the license system yet, but it's coming along. Let me know. msn is [email protected]
>>> Traceback (most recent call last): File "C:\Python264\lib\site-packages\pyinsim\pyinsim.py", line 2570, in __recvThread [self.__recv(sock) for sock in socks] File "C:\Python264\lib\site-packages\pyinsim\pyinsim.py", line 2591, in __recv [self.__onPacketData(pdata) for pdata in self.__buffer] File "C:\Python264\lib\site-packages\pyinsim\pyinsim.py", line 2608, in __onPacketData if isp: self.event(ptype, packet) File "C:\Python264\lib\site-packages\pyinsim\pyinsim.py", line 2475, in event [callback(self, *args) for callback in self.__callbacks[evt]] File "C:\Users\Jonathan\Pyinsim 164 beta\examples\cruise.py", line 407, in message_out CMD_LOOKUP[cmd0](ncn, cmd[1]) File "C:\Users\Jonathan\Pyinsim 164 beta\examples\cruise.py", line 174, in cmd_location x = pyinsim.meters(last_pos[0]) AttributeError: 'module' object has no attribute 'meters'
Thanks DarkTimes!
Edit:
Can I get some help with an !location or !position code
I have tried to make a code to print out the users coordinates (doesnt have to be a certain user, just the user who types it), but can't seem to get it.
I've picked up my cruise script project again thanks to DarkTimes's base script with 1.6.4 beta, and I'm loving it.
I've been doing some changes and additions, and so far so good. Except one thing.
I've tried making an !give code to send other users money. It's not very advanced and I know it will let you send money to yourself. but what I need to get done first is it actually giving money. Here is what I have:
#Change cash level def cmd_give(ncn, args): if args: for arg in args: ncn = arg.split(':')[-0] amt = arg.split(':')[-1] #insim.sendm('^3| ^7You are trying to send %s $%s' % (user, amt)) ncn.vars.cash += amt insim.sendm('cash changed')
The commented out line was for testing. I was trying to get it to say you are sending whatever user a certain amount. However that failed. It would print out 2 messages, saying "You are trying to send user $user" and "You are trying to send 1 $1".
Even though I figured I would have issues, I tried to keep going. Basically, I got as far as that. Any ideas? Here is what python shell tells me:
>>> Traceback (most recent call last): File "C:\Python264\lib\site-packages\pyinsim\pyinsim.py", line 2570, in __recvThread [self.__recv(sock) for sock in socks] File "C:\Python264\lib\site-packages\pyinsim\pyinsim.py", line 2591, in __recv [self.__onPacketData(pdata) for pdata in self.__buffer] File "C:\Python264\lib\site-packages\pyinsim\pyinsim.py", line 2608, in __onPacketData if isp: self.event(ptype, packet) File "C:\Python264\lib\site-packages\pyinsim\pyinsim.py", line 2475, in event [callback(self, *args) for callback in self.__callbacks[evt]] File "C:\Users\Jonathan\Pyinsim 164 beta\examples\cruise.py", line 267, in message_out CMD_LOOKUP[cmd0](ncn, cmd[1]) File "C:\Users\Jonathan\Pyinsim 164 beta\examples\cruise.py", line 231, in cmd_give ncn.vars.cash += amt AttributeError: 'str' object has no attribute 'vars'
I'm not totally new to Python, and neither is my friend.
he just doesn't like his codes floating around in the open without his consent.
I have no problem sending you the code. If you PM me I'll send you a link. I'm just not used to Insim programming. I have some basic experience with Python. I'm no major coder or anything, but it's not like I have never written a single line of code in my life.
I also had a few return true/return false from the original code from my friend, and I removed those as morpha recommended. Code still works fine. But I still get the
InSim Guest Closed: pyinsim
in live for speed dedi server as soon as I connect. I literally watched the server via teamviewer as I connected, and as soon as I connect right after the Learjet45 connected (learjet45) line, the insim closes the connection to pyinsim or whatever.
I'll try that EVT_ERROR bind and see if that helps.
Edit: That did the trick! Thanks tme! Here is what I get:
From python IDLE GUI.
If someone wants the code to look at, again feel free to PM me. I don't want it floating around for anyone to get hold of. My friend and I have tried to keeps our codes as private as possible, especially when it is developed specifically for our servers (in which case, the original code he gave me was made specifically for our clan's server).
Alright. I need some help now.
LFS closes the connection to insim as soon as the I connect. PM me for the file, I don't want it out in the open and neither does my friend who wrote the original code this is based on.
Well from what I have of my basic test code (connects to the MySQL database, searches for my username, and sends back info if it is found, next part varies depending on if it is found), and so far so good. I got rid of all my errors with the code and it will run just fine. But for some reason I have to use 192.168.1.104 for my IP for insim instead of localhost, I get the error that insim couldnt connect if I use localhost.
Anyways, I don't know what's up, but as soon as I join my server, insim shuts off basically.
It happens with the sample codes too. As soon as the event happens once (ex a racer speeds over 80 km/h in example 4 i believe), insim closes the connection and doesn't run anymore. How do I keep insim alive so it doesn't shut off?