我尝试制作服务器逻辑脚本。我不知道js,所以我尝试。我的桌名是玩家。
id Guid NamePlayer Score
1 b91518c3-759d-45ef-9ee0-5d7584d96924 user 0
2 e65661f5-88bf-467c-b850-290ec3f1e07d empty 0
3 5636dde3-9ec3-47e4-92df-0295b16d4c70 empty 0
4 7e1e6c9b-adcc-4fbd-92d5-ac8fb0f75177 empty 0
5 7b5f6e4b-696d-4aea-93e0-1cc6309046a5 empty 0
6 40c80b1c-89f3-4628-bf11-eeb954902d33 emptydd 0
7 c9024cbb-760b-49ce-917a-cc7d607e9290 empty 0
8 36f553ce-1ab4-4b9c-b693-10df8f795e0a emptymm 0
这是我的逻辑。
function insert(item, user, request) {
var players = tables.getTable('player');
for (var index = 0; index < players.length; index++) {
if(players[index].NamePlayer===item.NamePlayer){
console.log('One user have this name');
}else {
request.execute();
}
}
}
我如何修复?