Prevent usechar unless in char select mode
This commit is contained in:
@@ -112,6 +112,8 @@ function createSubAccount(accountId, firstName, lastName, skinId, dateOfBirth, p
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
function showCharacterSelectToClient(client) {
|
function showCharacterSelectToClient(client) {
|
||||||
|
getPlayerData(client).switchingCharacter = true;
|
||||||
|
|
||||||
if(doesPlayerHaveAutoSelectLastCharacterEnabled(client)) {
|
if(doesPlayerHaveAutoSelectLastCharacterEnabled(client)) {
|
||||||
if(getPlayerData().subAccounts != null) {
|
if(getPlayerData().subAccounts != null) {
|
||||||
if(getPlayerData().subAccounts.length > 0) {
|
if(getPlayerData().subAccounts.length > 0) {
|
||||||
@@ -254,6 +256,9 @@ async function selectCharacter(client, characterId = -1) {
|
|||||||
}, client.ping+1000);
|
}, client.ping+1000);
|
||||||
|
|
||||||
updateAllPlayerNameTags();
|
updateAllPlayerNameTags();
|
||||||
|
|
||||||
|
getPlayerData(client).switchingCharacter = false;
|
||||||
|
triggerNetworkEvent("ag.jobType", client, tempSubAccount.job);
|
||||||
}
|
}
|
||||||
addNetworkHandler("ag.selectCharacter", selectCharacter);
|
addNetworkHandler("ag.selectCharacter", selectCharacter);
|
||||||
|
|
||||||
@@ -292,6 +297,11 @@ function newCharacterCommand(command, params, client) {
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
function useCharacterCommand(command, params, client) {
|
function useCharacterCommand(command, params, client) {
|
||||||
|
if(!getPlayerData(client).switchingCharacter) {
|
||||||
|
messagePlayerError(client, "Use /switchchar to save this character and return to the characters screen first!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if(areParamsEmpty(params)) {
|
if(areParamsEmpty(params)) {
|
||||||
messageClientSyntax(client, getCommandSyntaxText(command));
|
messageClientSyntax(client, getCommandSyntaxText(command));
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user