Jump to content

[Solved] Spawn Script


Recommended Posts

So, first... I'm really noob at programming, and I was trying to create a spawn screen script...

But when the even is called, it calls all the commands but the spawnPlayer... It says it is expecting a player at argument 1, but i really don't know what to put in there. I've looked a lot of MTA Wiki pages, tried a lot of things but i can't make it work.

It could be a really stupid thing, but as I said, im really new at programming.

1Q2l4vi.png

Thanks to CodyL, for the fix :D

Edited by Guest
Link to comment

change player source to client assuming this is a server side script and being called from a client side.

If not, post the section of code that calls this function. You may need to put (PlayerSource) in the brackets for this function if it is being sent over by the calling function.

Link to comment

This is the client side script:

rootElement = getRootElement() 
  
-- Lots of things in between...  
  
function spawnPoliceOfficerLS ( button ) 
    if button == "left" then 
        triggerServerEvent("onSpawnPoliceOfficerLS", rootElement) 
    end 
end 

It calls the server side when player click the button to spawn.

Link to comment

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...