30.12.2010, 14:08
(
Последний раз редактировалось Fabsch; 03.01.2011 в 16:07.
)
Quote:
|
Why it doesn't work?
And also when I try to compile python.pwn with pawno it can't find the include file in pawno/include Also there is some problems compiling with Vistual C++ 2010 One more thing. The error above is only with 0.3c, I tried it with 0.3b and it did excute with errors and warnings |
You can ignore the warnings I mentioned in the first post with 0.3b (see that post, if you use 0.3c).
Which errors exactly do you get (or what problems do you have) when trying to compile the plugin? Have you set the Python include and library directories correctly?
Quote:
|
Originally Posted by Retardedwolf
You should list the advantages comparing Python to Pawn.
|
For example, you can write a player class, which contains any player-specific information and add one global dictionary. Then you can create a new instance of that class whenever a player connects, and add it to the dictionary. When a player disconnects, you can then remove his entry.
Код:
from samp import *
class player(object):
def __init__(self, playerid):
self.playerid = playerid
self.senselessInfo = 123
# any other needed player variables
players = {}
def OnPlayerConnect(playerid):
# add a new instance of the player class to the global player dictionary
players[playerid] = player(playerid)
def OnPlayerDisconnect(playerid, reason):
# delete that player from the dictionary
del players[playerid]
Код:
for pl in players:
printf("Player %d: %d" % (players[pl].playerid, players[pl].senselessInfo))
Код:
if playerid in players:


