Andres99907 Posted September 15, 2020 Share Posted September 15, 2020 function comprarbandito ( thePlayer, command) local playeraccount = getPlayerAccount ( source ) takePlayerMoney ( thePlayer, 500000 ) setAccountData ( playeraccount, "rc.bandito", adquirido ) end addCommandHandler ( "comprarbandito", comprarbandito ) function Banditoadquirido (_, playeraccount ) if ( playeraccount ) then local ban = getAccountData ( playeraccount, "rc.bandito" ) if ( ban ) then Banditocomprado = true end end end addEvent ( "banditobuyed", true ) addEventHandler ( "banditobuyed", getRootElement(), Banditoadquirido ) This function takes 500000 dollars to give a player permission to use a RC Bandito in a gui (Like in GTA Online) but, when i put the command "comprarbandito" Bad argument @ getplayeraccount, got nil, i never used getplayeraccount or setplayeraccount, and i don't know if the other function (Banditoadquirido) will work Link to comment
Moderators IIYAMA Posted September 15, 2020 Moderators Share Posted September 15, 2020 1 hour ago, Andres99907 said: argument @ getplayeraccount, got nil source is only available for events (functions that are executed when an event is triggered +addEventHandler). So it's value is in this case nil(no value). Use thePlayer instead, since you need a player element for the function 'getPlayerAccount.' 1 Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now