[BC]VACEDA[NWD] Posted May 13, 2020 Posted May 13, 2020 mp.events.addCommand('pm', (player, _, playerID, msg) => { //mensagem privada let sourcePlayer = mp.players.at(parseInt(playerID)) if(isNaN(parseInt(playerID)) || !msg){ player.outputChatBox(`!{${info}}[INFO]: Use /pm [id] [msg]`) } else if (player == sourcePlayer){ player.outputChatBox(`!{${erro}}[ERRO]: Você não pode mandar pm para você mesmo`) } else if (sourcePlayer) { player.outputChatBox(`!{${pm}} [PM ENVIADA] ${player.name}: ${msg}`) sourcePlayer.outputChatBox(`!{${pm}}[PM RECEBIDA] ${player.name}[${player.id}]: ${msg}`) console.log(`[PM] ${player.name}[${player.id}]: ${msg}`) //console } else{ player.outputChatBox(`!{${erro}}[ERRO]: Jogador não encontrado com esse ID`) } }); only the first word of the message is sent, help
[BC]VACEDA[NWD] Posted May 13, 2020 Author Posted May 13, 2020 SOLVED!! mp.events.addCommand('pm', (player, msg) => { //mensagem privada playerID = msg[0] let sourcePlayer = mp.players.at(parseInt(playerID)) if(isNaN(parseInt(playerID)) || !msg.slice(2) || msg[1] != ` `){ player.outputChatBox(`!{${info}}[INFO]: Use /pm [id] [msg]`) } else if (player == sourcePlayer){ player.outputChatBox(`!{${erro}}[ERRO]: Você não pode mandar pm para você mesmo`) } else if (sourcePlayer) { player.outputChatBox(`!{${pm}} [PM ENVIADA] ${player.name}: ${msg.slice(2)}`) sourcePlayer.outputChatBox(`!{${pm}}[PM RECEBIDA] ${player.name}[${player.id}]: ${msg.slice(2)}`) console.log(`[PM] ${player.name}[${player.id}]: ${msg.slice(2)}`) //console } else{ player.outputChatBox(`!{${erro}}[ERRO]: Jogador não encontrado com esse ID`) } });
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