Search the Community
Showing results for tags 'игрок'.
Found 1 result
-
После создании структуры персонажа не удается вызвать функцию из структуры Существует данный скрипт global.PLAYERS = {}; function AddPlayer(playerid, skin, name, health, armor, eat, money, bank, weapons, arrests, stars, drugs, fraction, rank) { PLAYERS[playerid] = {}; const temp = {}; temp.name = name; temp.skin = skin; temp.health = health; temp.armor = armor; temp.eat = eat; temp.money = money; temp.bank = bank; temp.weapons = weapons; temp.arrests = arrests; temp.stars = stars; temp.fraction = fraction; temp.rank = rank; temp.drugs = drugs; this.GetName=function(){ return this.name; } this.GetSkin=function(){ return this.skin; } this.SetSkin=function(skin){ this.skin = skin; } this.GetHp=function(){ return this.health; } this.SetHp=function(health){ this.health = health; } this.GetHp=function(){ return this.health; } this.SetHp=function(health){ this.health = health; } this.GetArm=function(){ return this.armor; } this.SetArm=function(armor){ this.armor = armor; } this.GetEat=function(){ return this.eat; } this.SetEat=function(eat){ this.eat = eat; } this.GetMoney=function(){ return this.money; } this.SetMoney=function(money){ this.money = money; } this.GetBank=function(){ return this.bank; } this.SetBank=function(bank){ this.bank = bank; } this.GetDrugs=function(){ return this.drugs; } this.SetDrugs=function(drugs){ this.drugs = drugs; } this.GetWeapons=function(){ return this.weapons; } this.SetBank=function(weapons){ this.weapons = weapons; } this.AddWeapon=function(weapon){ this.weapons.push(weapon);} this.RemoveWeapon=function(weapon){ this.weapons.remove(this.indexOf(weapon));} this.GetArrests=function(){ return this.arrests; } this.AddArrests=function(){ this.arrests += 1; } this.GetStars=function(){ return this.stars; } this.SetStars=function(stars){ this.stars = stars; } this.GetFraction=function(){ return this.fraction; } this.SetFraction=function(fraction){ this.fraction = fraction; } this.GetRank=function(){ return this.rank; } this.SetRank=function(rank){ this.rank = rank; } PLAYERS[playerid] = temp; } function RemovePlayer(playerid) { PLAYERS[playerid] = {}; } При подключении игрока вызывается эвент "playerJoin" а в нем функция : AddPlayer(player.id, models["a_f_y_hipster_02"], player.name, 100, 100, 100, 500, 0, {"Pistol": 900}, 0, 0, 0, 0, 0); В мод добавлена команда: "getdata": (player, args) => { let id = player.id; player.outputChatBox('Name:<br /><b>'+PLAYERS[id].name+'</b>'); player.outputChatBox('skin:<br /><b>'+PLAYERS[id].skin+'</b>'); player.outputChatBox('health:<br /><b>'+PLAYERS[id].health+'</b>'); player.outputChatBox('armor:<br /><b>'+PLAYERS[id].armor+'</b>'); player.outputChatBox('eat:<br /><b>'+PLAYERS[id].eat+'</b>'); player.outputChatBox('money:<br /><b>'+PLAYERS[id].money+'</b>'); player.outputChatBox('bank:<br /><b>'+PLAYERS[id].bank+'</b>'); }, При вызове команды выходит ошибка, PLAYERS[0].name is not defined где именно я накосячил с ООП структурой? (P.S переходил с Lua )
