LT.Steiner Posted March 29, 2020 Posted March 29, 2020 Hello Dear RAGE MP Community, how can i make Variable userID for players? Right now i should write player name to do something. for examlpe: /goto MikeAllen i would like to use /goto 5 just using ID for players. how can i do this?
MrPancakers Posted March 30, 2020 Posted March 30, 2020 Use mp.players.at(id) and that gets the player with that ID https://wiki.rage.mp/index.php?title=Pool::at
PanaFive Posted April 14, 2020 Posted April 14, 2020 mp.events.addCommand('heal', (player, _, playerID, health) => {// ok admin if (playerID && playerID.trim().length > 0 && health) { const giveplayer = findRageMpPlayer(playerID); if (giveplayer) { if (health >= 0 || health <= 100) { giveplayer.health = health; } else return player.outputChatBox(`[Usage]: /heal [PlayerID/PartieDuNom] [Ammount]`); } else return player.notify(`Player not connected`); } else return player.outputChatBox(`[Usage]: /heal [PlayerID/PartieDuNom] [Ammount]`); }); function findRageMpPlayer(playerNameOrPlayerId) { if (playerNameOrPlayerId == parseInt(playerNameOrPlayerId)) { return mp.players.at(playerNameOrPlayerId); } else { let foundPlayer = null; mp.players.forEach((rageMpPlayer) => { if (rageMpPlayer.name.toLowerCase().startsWith(playerNameOrPlayerId.toLowerCase())) { foundPlayer = rageMpPlayer; return; } }); return foundPlayer; } } 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now