[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Question about pointer......
- From: Eero Pajarre <epajarre@...>
- Date: Wed, 05 Mar 2003 10:18:52 +0200
Ben Sunshine-Hill wrote:
I would like to ask a question.... for a MMO RPG wrote by C++ and
using LUA as a script tools..... when a player access the script like
if (gold >= 5000)
How do the server know which player will be decreased $5000 since
in LUA doesn't know the player UIN......
Lua will know the player UIN if you tell it the player UIN. But I think your
code would probably look more like the following:
if(myPlayer.gold >= 5000) then
myPlayer.gold -= 5000
In this situation you might need to protect players from each other.
So maybe the setup is like this:
/* in C++ or C code */
/* now lua references to gold mean UIN.gold */
/* now lua references to gold mean OTHER_UIN.gold */