Start working on skin selector for clothes item
This commit is contained in:
@@ -68,6 +68,8 @@ let drunkEffectDurationTimer = null;
|
|||||||
|
|
||||||
let controlsEnabled = false;
|
let controlsEnabled = false;
|
||||||
|
|
||||||
|
let usingSkinSelector = false;
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
addEvent("OnLocalPlayerEnterSphere", 1);
|
addEvent("OnLocalPlayerEnterSphere", 1);
|
||||||
@@ -121,6 +123,27 @@ bindEventHandler("onResourceStop", thisResource, function(event, resource) {
|
|||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
addEventHandler("onKeyUp", function(event, virtualKey, physicalKey, keyModifiers) {
|
||||||
|
if(usingSkinSelector) {
|
||||||
|
if(physicalKey == SDLK_d) {
|
||||||
|
if(getGameData(gta.game).allowedSkins.length-1 == skinSelectorIndex) {
|
||||||
|
skinSelectorIndex = 0;
|
||||||
|
}
|
||||||
|
localPlayer.skin = getGameData(gta.game).allowedSkins[skinSelectorIndex];
|
||||||
|
} else if(physicalKey == SDLK_a) {
|
||||||
|
if(getGameData(gta.game).allowedSkins.length-1 == 0) {
|
||||||
|
skinSelectorIndex = getGameData(gta.game).allowedSkins.length-1;
|
||||||
|
}
|
||||||
|
localPlayer.skin = getGameData(gta.game).allowedSkins[skinSelectorIndex];
|
||||||
|
} else if(physicalKey == SDLK_RETURN) {
|
||||||
|
triggerNetworkEvent("ag.skinSelected", getGameData(gta.game).allowedSkins[skinSelectorIndex]);
|
||||||
|
usingSkinSelector = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
addNetworkHandler("ag.cameraLookAt", function(cameraPosition, cameraLookat) {
|
addNetworkHandler("ag.cameraLookAt", function(cameraPosition, cameraLookat) {
|
||||||
logToConsole(LOG_DEBUG, `[Asshat.Main] Set camera to look at ${cameraPosition.x}, ${cameraPosition.y}, ${cameraPosition.z}`);
|
logToConsole(LOG_DEBUG, `[Asshat.Main] Set camera to look at ${cameraPosition.x}, ${cameraPosition.y}, ${cameraPosition.z}`);
|
||||||
gta.setCameraLookAt(cameraPosition, cameraLookat, true);
|
gta.setCameraLookAt(cameraPosition, cameraLookat, true);
|
||||||
@@ -460,6 +483,10 @@ addEventHandler("OnDrawnHUD", function (event) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(usingSkinSelector) {
|
||||||
|
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
@@ -859,4 +886,16 @@ function getPedFromNetworkEvent(ped) {
|
|||||||
return getElementFromId(ped);
|
return getElementFromId(ped);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
addNetworkHandler("ag.skinSelect", function() {
|
||||||
|
usingSkinSelector = true;
|
||||||
|
let frontCameraPosition = getPosInFrontOfPos(localPlayer.position, localPlayer.heading, 5);
|
||||||
|
setCameraLookAt(frontCamPos, localPlayer.position);
|
||||||
|
gui.toggleCursor(true, false);
|
||||||
|
localPlayer.invincible = true;
|
||||||
|
localPlayer.setProofs(true, true, true, true, true);
|
||||||
|
localPlayer.collisionsEnabled = false;
|
||||||
|
});
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
Reference in New Issue
Block a user