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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.