[Plugin] Python
#21

Well this plugin useless because its slower than pawn and there are more of disadvantages.
Reply
#22

if you know how you can make lots of useful scripts with python for samp only samp functions through python are slow..
Reply
#23

Why should it be useless just because it's a bit slower when calling SAMP functions? It's not that slow, that you will realize any difference with usual scripts for SAMP anyway.
Even if there are some disadvantages (though I only know one, which do you mean?), there are much more advantages of Python over PAWN; you can just get most things done faster and easier in Python.
Reply
#24

What's the rationale behind tupled colors? I personally find hex numbers more handy as tuples require writing four numbers instead of just one. Could you make it so it will accept colors in both formats?

Great job btw!
Reply
#25

Cool, I live programs like this created by people of the community, they just seem more ease of access and easy to use. 5/5
Reply
#26

nice plugin trying it out
Reply
#27

Quote:
Originally Posted by Wyu
Посмотреть сообщение
What's the rationale behind tupled colors? I personally find hex numbers more handy as tuples require writing four numbers instead of just one. Could you make it so it will accept colors in both formats?
Well, I first tried it with integers, but for example 0xFFFFFFFF is of type long in Python and I had problems converting it.
I just tried it again a bit and it works with PyLong_AsUnsignedLong; you can now use both.
Reply
#28

Hope this project's just dormant and not completely dead.

I revisited what I started writing and I noticed that return True and return False are not longer equivalent with return 1 and return 0 when it comes to halting the SA-MP server's processing on callbacks. I don't know if this is the intended behavior or not; I suppose it isn't a huge issue.

Also, I get this error:

Quote:

ImportError: /usr/lib/pymodules/python2.7/_mysql.so: undefined symbol: PyExc_ImportError

when trying to use that Python MySQL module under Linux. The Windows binary I was able to find works perfectly. Is this a plugin-specific thing or do I just need to build my own python-mysql binary?
Reply
#29

I'm still working on it, but I currently have other projects I'm primarily working on. Currently I'm fixing some bugs (wrong calls to PyMem_Free in functions with string parameters; still problems with timers, I will probably have to do them myself and not use SAMP functions).

Quote:
Originally Posted by mkr
Посмотреть сообщение
I revisited what I started writing and I noticed that return True and return False are not longer equivalent with return 1 and return 0 when it comes to halting the SA-MP server's processing on callbacks. I don't know if this is the intended behavior or not; I suppose it isn't a huge issue.
That was not intended, I'll fix it with the next release.


Quote:
Originally Posted by mkr
Посмотреть сообщение
Also, I get this error:

Quote:

ImportError: /usr/lib/pymodules/python2.7/_mysql.so: undefined symbol: PyExc_ImportError

when trying to use that Python MySQL module under Linux. The Windows binary I was able to find works perfectly. Is this a plugin-specific thing or do I just need to build my own python-mysql binary?
Well, I had the same issue a few weeks ago, but I think there is nothing I can do about it. The _mysql module from MySQLdb and most (if not all) modules written in C aren't linked against the Python library. You will have to compile them yourself and link against the Python library using python-config --ldflags. MySQLdb also needs the datetime module, you also have to compile it from the Python source code and link it against the Python library.
Reply
#30

when i am trying to run the server, my script is not loaded while i am playing, does anywone can tell me why? plz i need help, this is the error:

Script[gamemodes/python.amx]: Run time error 19: "File or function is not found"
Reply
#31

Kinda complicated with all the functions and callbacks, but nice work, at least if it works fine.
Reply
#32

Quote:
Originally Posted by Sfinx_17
Посмотреть сообщение
Script[gamemodes/python.amx]: Run time error 19: "File or function is not found"
This is either because you don't have the plugin loaded (see the server log whether the plugin was loaded correctly) or because you have the wrong python.amx (the one provided with the packages only works for 0.3c, for earlier versions you have to remove the functions not available in your version from python.pwn and recompile the script).

Quote:
Originally Posted by GangsTa_
Посмотреть сообщение
Kinda complicated with all the functions and callbacks, but nice work, at least if it works fine.
Actually, most functions and callbacks are exactly the same as you use in PAWN, so they shouldn't be any more complicated in Python.
Reply
#33

i saw my log file and i founded two errors, one is where it says:

----------
Loaded log file: "server_log.txt".
----------

SA-MP Dedicated Server
----------------------
v0.3c R2, ©2005-2011 SA-MP Team

[23:29:29]
[23:29:29] Server Plugins
[23:29:29] --------------
[23:29:29] Loaded 0 plugins.

[23:29:29] I couldn't load any gamemode scripts. Please verify your server.cfg
[23:29:29] It needs a gamemode0 line at the very least.


and the other error it says:

SA-MP Dedicated Server
----------------------
v0.3c R2, ©2005-2011 SA-MP Team

[19:06:35]
[19:06:35] Server Plugins
[19:06:35] --------------
[19:06:35] Loading plugin: pythonplugin.so
[19:06:35] Failed.
[19:06:35] Loaded 0 plugins.

[19:06:35]
[19:06:35] Filter Scripts
[19:06:35] ---------------
[19:06:35] Loading filter script 'base.amx'...
[19:06:35]
--Base FS loaded.

[19:06:35] Loading filter script 'gl_actions.amx'...
[19:06:35] Loading filter script 'gl_property.amx'...
[19:06:35]
-----------------------------------
[19:06:35] Grand Larceny Property Filterscript
[19:06:35] -----------------------------------

[19:06:35] Loading filter script 'gl_realtime.amx'...
[19:06:35] Loading filter script 'gl_mapicon.amx'...
[19:06:35] Loading filter script 'ls_elevator.amx'...
[19:06:35] Loaded 6 filter scripts.

[19:06:35] Reading File: blank
[19:06:35] Reading File: properties/houses.txt
[19:06:35] Reading File: properties/businesses.txt
[19:06:35] Reading File: properties/banks.txt
[19:06:35] Reading File: properties/police.txt
[19:06:35] Script[gamemodes/python.amx]: Run time error 19: "File or function is not found"
[19:06:35] Number of vehicle models: 0
[19:06:48] --- Server Shutting Down.

So the first error is this:
[23:29:29] I couldn't load any gamemode scripts. Please verify your server.cfg
[23:29:29] It needs a gamemode0 line at the very least.

and the second is this:
[19:06:35]
[19:06:35] Server Plugins
[19:06:35] --------------
[19:06:35] Loading plugin: pythonplugin.so
[19:06:35] Failed.
[19:06:35] Loaded 0 plugins.

this is my server.cfg settings i need help plz

echo Executing Server Config...
lanmode 0
rcon_password changeme
maxplayers 32
port 7777
hostname test for python
gamemode0 python 1
filterscripts base gl_actions gl_property gl_realtime gl_mapicon ls_elevator
announce 0
query 1
weburl www.sa-mp.com
onfoot_rate 40
incar_rate 40
weapon_rate 40
stream_distance 300.0
stream_rate 1000
maxnpc 0
logtimeformat [%H:%M:%S]
plugins pythonplugin.so
Reply
#34

This looks like you don't have the plugin in the plugins directory. What OS do you have and how does your plugins directory look like?
Reply
#35

are there any bugs or something??, i looks so good, im going to use it, is it stable or there are bugs?
Reply
#36

Well, at least there are no known bugs anymore, except that you would still have to manually recompile Python modules written in C and link them against the Python library on Linux; I'm not yet sure what I can do about that (Edit: I could just fix that issue). For me everything is working without any problems or crashes, only some of the SAMP natives are still untested, but probably all of them work.
Reply
#37

Awesome! I'll trying it!
Reply
#38

Quite complicated, but nice.
Reply
#39

This looks just great!
I had to do with python years ago and it was just awesome to script with it.
Now I found a good use for it again, thank you
Reply
#40

Last night I studied Python. Thanks to Fabsch for night without sleep
Python is a very great and easy to use language.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)