Sign in to follow this  
underground475

event problem

Recommended Posts

Posted (edited)

Hi everyone
I have a problem with my own created event
if i let the server send a number everything works fine but if it is a string it will not work properly hope someone can help with that

ServerEvent

[RemoteEvent("OnPlayerLoginAttempt")]
        public void OnPlayerLoginAttempt(Client player, string username)
        {

            Client gesuchterspieler = NAPI.Player.GetPlayerFromName(username);
            if (gesuchterspieler != null)
            {  
                String SNAME = gesuchterspieler.SocialClubName;
                player.TriggerEvent("LoginResult",SNAME);
            }
            
        }

Client

mp.events.add('LoginResult', (name) => {
mp.gui.chat.push("Server hat den namen: "+name+" zurück geschickt");
speedo.execute(`update(${test});`); //  <-- only work with numbers
});

CEF

function update(name)
	{		
		sendinfotoserver(name);
	}
	function sendinfotoserver(name)
	{
		document.getElementById("spielername").innerHTML = "name: "+name;
	}

 

thanks

Edited by underground475

Share this post


Link to post
Share on other sites

Try to think about it like you're running the function yourself. You're gonna use update("name");. The problem is that you're using update(name) which returns an error. just put ${test} inside quotes so it is processed as a string.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.