Skip to content

Instantly share code, notes, and snippets.

@huzpsb
Last active September 4, 2024 09:04
Show Gist options
  • Save huzpsb/728e2c1e1abfb6f70d096b92291c9b82 to your computer and use it in GitHub Desktop.
Save huzpsb/728e2c1e1abfb6f70d096b92291c9b82 to your computer and use it in GitHub Desktop.
pevt sample
fetch('https://huzpsb.eu.org/pevt.js#' + new Date().getTime()).then(response => response.text()).then(code => {
eval(code);
statusMap = new Map()
TriggerTrap = function (p) {
InventoryWear(p, 'LeatherArmbinder', 'ItemArms', '#202020', 114514)
InventoryWear(p, 'Irish8Cuffs', 'ItemFeet', '#202020', 114514)
InventoryWear(p, 'TheDisplayFrame', 'ItemDevices', '#202020', 114514)
ChatRoomCharacterUpdate(p)
}
EmitMapMoveEvent = function (e) {
/*
* This event will be triggered when a player moves to a new tile.
* If you need further description over the material id, please refer to Ben987's code.
* -
* Description of the structure of the event object:
* player int notnull - the player's member number
* posX int notnull - the player's x position
* posY int notnull - the player's y position
* destMat int notnull - the material of the tile the player is moving to
* isSelf bool notnull - whether the player is the player running the script
*/
if (!statusMap.has(e.player)) {
statusMap.set(e.player, false)
}
const wasWet = statusMap.get(e.player);
const isWet = (e.destMat >= 2000 && e.destMat <= 2999);
if (wasWet !== isWet) {
statusMap.set(e.player, isWet)
ServerSend('ChatRoomChat', {
Content: e.playerObj.Name + (isWet ? ' triggered the trap!' : ' escaped from the trap!'),
Type: 'Chat',
})
if (isWet) {
TriggerTrap(e.playerObj)
}
}
}
}).catch(error => console.error(error));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment