alex_r
-
Posts
6 -
Joined
-
Last visited
Content Type
Profiles
Forums
Downloads
Posts posted by alex_r
-
-
Good job! Also I bit updated your code:
function findPlayerByIdOrNickname(playerName) { if (playerName == parseInt(playerName)) return mp.players.at(playerName); else { let foundPlayer = null; mp.players.forEach((_player) => { if (_player.name === playerName) { foundPlayer = _player; break; } }); return foundPlayer; } } module.exports = { // Add command `/pm` "pm": (player, args, fullcmd) => { // Check args if (args.length < 3 || !args[1].length || !args[2].length) { player.outputChatBox('Valid syntax: <b>/pm [recipient_id_or_nickname] [text_message]</b>'); return false; } // Search recipient by second argument const recipient = findPlayerByIdOrNickname(args[1]); // If recipient not found show special message if (!recipient) { player.outputChatBox('<b>User not found</b>'); return false; } // Source message const message = fullcmd.substr(fullcmd.indexOf(args[1]) + args[1].length + 1); // Generate chat string in the following format: // [PM] Sender_Nickname[Sender_Id] -> Recipient_Nickname[Recipient_Id]: Text message const str = `<b>[PM] ${player.name}[${player.id}] -> ${recipient.name}[${recipient.id}]</b>: ${message}`; // Send message to recipient recipient.outputChatBox(str); // Send message to sender player.outputChatBox(str); } };
-
1
-
-
Just now, Captien said:
added Google Pixel thanks for suggestion
Oh I have already voted :((
-
Why Google Pixel XL is mising here?

-
1
-

Add Command Line to server console
in Tutorials
Posted
Isn't it better to make separate package?