Use new native util functions

This commit is contained in:
Vortrex
2020-12-12 06:11:16 -06:00
parent df178de9e6
commit d4efdcd096
9 changed files with 83 additions and 52 deletions

View File

@@ -35,11 +35,11 @@ addNetworkHandler("ag.onPlayerExitSphere", function(client, sphere) {
// ---------------------------------------------------------------------------
addNetworkHandler("ag.promptAnswerNo", function(client) {
if(!client.getData("ag.prompt")) {
if(!getEntityData(client, "ag.prompt")) {
return false;
}
switch(client.getData("ag.prompt")) {
switch(getEntityData(client, "ag.prompt")) {
case AG_PROMPT_CREATEFIRSTCHAR:
triggerNetworkEvent("ag.showError", client, "You don't have a character to play. Goodbye!", "No Characters");
setTimeout(function() { client.disconnect(); }, 5000);
@@ -55,11 +55,11 @@ addNetworkHandler("ag.promptAnswerNo", function(client) {
// ---------------------------------------------------------------------------
addNetworkHandler("ag.promptAnswerYes", function(client) {
if(!client.getData("ag.prompt")) {
if(!getEntityData(client, "ag.prompt")) {
return false;
}
switch(client.getData("ag.prompt")) {
switch(getEntityData(client, "ag.prompt")) {
case AG_PROMPT_CREATEFIRSTCHAR:
triggerNetworkEvent("ag.showNewCharacter", client);
break;
@@ -92,7 +92,7 @@ addNetworkHandler("ag.onPlayerEnterSphere", function(client, sphere) {
addNetworkHandler("ag.afk", function(client, afkState) {
if(afkState) {
client.setData("ag.afk", true, true);
setEntityData(client, "ag.afk", true, true);
} else {
client.removeData("ag.afk");
}
@@ -125,16 +125,16 @@ addNetworkHandler("ag.heldKey", function(client, key) {
addNetworkHandler("ag.player.sync", function(client, position, heading) {
//console.log(`POS: ${position}, X: ${position.x}, Y: ${position.y}, Z: ${position.z}`);
client.setData("ag.position", position, true);
client.setData("ag.heading", heading, true);
setEntityData(client, "ag.position", position, true);
setEntityData(client, "ag.heading", heading, true);
});
// ---------------------------------------------------------------------------
addNetworkHandler("ag.player.death", function(client, position, heading) {
//console.log(`POS: ${position}, X: ${position.x}, Y: ${position.y}, Z: ${position.z}`);
client.setData("ag.position", position, true);
client.setData("ag.heading", heading, true);
setEntityData(client, "ag.position", position, true);
setEntityData(client, "ag.heading", heading, true);
processPlayerDeath(client);
});
@@ -146,16 +146,15 @@ addNetworkHandler("ag.veh.sync", function(client, syncId, position, heading) {
vehicleData.syncPosition = position;
vehicleData.syncHeading = heading;
}
});
// ---------------------------------------------------------------------------
addNetworkHandler("ag.iv.veh", function(client, syncId) {
addNetworkHandler("ag.player.vehicle", function(client, syncId) {
if(syncId == -1) {
client.removeData("ag.vehicle");
} else {
client.setData("ag.vehicle", syncId, true);
setEntityData(client, "ag.vehicle", syncId, true);
}
});