Matt
Banned
- Joined
- May 9, 2013
- Messages
- 595
- Reaction score
- 46
Hej.
Napisa?em kiedy? t? funkcj? i nie widzia?em jej pod 7.6, wi?c postanowi?em Wam udost?pni?.
Opis: Zwraca ile gracz ma przedmiot?w o danym id.
Kod:
actions.cpp wklejamy pod:
to:
Dalej, pod ca?? funkcj?:
czyli na ko?cu, po ostatnim }
dodajemy:
Przechodzimy do actions.h i pod:
wklepujemy:
To tyle, mo?e si? komu? przyda.
Pozdrawiam,
Matt.
Napisa?em kiedy? t? funkcj? i nie widzia?em jej pod 7.6, wi?c postanowi?em Wam udost?pni?.
Opis: Zwraca ile gracz ma przedmiot?w o danym id.
Kod:
actions.cpp wklejamy pod:
PHP:
//doRemoveItem(uid,n)
lua_register(luaState, "doRemoveItem", ActionScript::luaActionDoRemoveItem);
PHP:
//doGetPlayerItemCount(cid,itemid)
lua_register(luaState, "doGetPlayerItemCount", ActionScript::luaActionDoGetPlayerItemCount);
Dalej, pod ca?? funkcj?:
PHP:
int ActionScript::luaActionDoRemoveItem(lua_State *L)
dodajemy:
PHP:
int ActionScript::luaActionDoGetPlayerItemCount(lua_St ate *L)
{
//getPlayerItemCount(cid,itemid)
unsigned short itemid = (unsigned short)internalGetNumber(L);
unsigned int cid = (unsigned int)internalGetNumber(L);
ActionScript *action = getActionScript(L);
const KnownThing* tmp = action->GetPlayerByUID(cid);
if(tmp){
Player *player = (Player*)(tmp->thing);
lua_pushnumber(L, player->getItemCount(itemid));
}
else{
lua_pushnumber(L, -1);
std::cout << "luaDoPlayerCountItem: player not found" << std::endl;
return 1;
}
return 1;
}
Przechodzimy do actions.h i pod:
PHP:
static int luaActionDoRemoveItem(lua_State *L);
PHP:
static int luaActionDoGetPlayerItemCount(lua_State *L);
To tyle, mo?e si? komu? przyda.
Pozdrawiam,
Matt.