Dante94 Posted May 3, 2013 Share Posted May 3, 2013 First of all a big hello to you all Now, here's my problem. I recently started an RP server and we are building the gamemode using the paradise roleplay gamemode (yea, you can laugh ) but we can't figure out how to get our commands working. Infact we added a new folder containing the files and the resource gets loaded without problems but then when we use the command in game it doesn't work. Also we can't figure out how to give weapons and money to players. Hope someone can help us out and tell us what we are missing ^^ Link to comment
PaiN^ Posted May 3, 2013 Share Posted May 3, 2013 I think paradise roleplay gamemode is a privte script . We don't give support with leacked scripts ! Link to comment
Mega9 Posted May 3, 2013 Share Posted May 3, 2013 I think paradise roleplay gamemode is a privte script .We don't give support with leacked scripts ! MTA Paradise is a free roleplay gamemode. Link to comment
Baseplate Posted May 3, 2013 Share Posted May 3, 2013 lol, paradise is leaked? get yourself updated, vG is leaked, paradise is free for use to everyone. Link to comment
PaiN^ Posted May 3, 2013 Share Posted May 3, 2013 I didn't know that ! In this case, Post your script so we can help you . Link to comment
Dante94 Posted May 3, 2013 Author Share Posted May 3, 2013 Okay i figured out how to get them start but i have a problem with one of these: function pay(player, amount) if( givePlayerMoney ( player, tonumber(amount) ) ) then outputChatBox ("Hai dato dei soldi", source, 255, 255, 255, true ) end end addCommandHandler ( "gmoney", pay ) It says WARNING: commands\script.lua:20: Bad argument @ 'givePlayerMoney' Link to comment
DiSaMe Posted May 3, 2013 Share Posted May 3, 2013 As addCommandHandler page in wiki says, handler function has player and command name as the first parameters: player playerSource, string commandName, [string arg1, string arg2, ...] So the first line should look like this: function pay(player, command, amount) In addition, since player may enter the command without writing the amount, you should check if tonumber(amount) returns a number value. Otherwise warning messages will show up. Link to comment
Dante94 Posted May 3, 2013 Author Share Posted May 3, 2013 Adding command didn't change anything but also, if we set a fixed import instead of a var (like 100 dollars) it works BUT it appear to be only on client side, infact when we relog the money are gone. (we also use a mysql database if it's important) Link to comment
فاّرس Posted May 4, 2013 Share Posted May 4, 2013 (edited) Okay i figured out how to get them start but i have a problem with one of these: function pay(player, amount) if( givePlayerMoney ( player, tonumber(amount) ) ) then outputChatBox ("Hai dato dei soldi", source, 255, 255, 255, true ) end end addCommandHandler ( "gmoney", pay ) It says WARNING: commands\script.lua:20: Bad argument @ 'givePlayerMoney' amount = ?? function pay(player) if (givePlayerMoney ( player, 200 ) then outputChatBox ("Hai dato dei soldi", source, 255, 255, 255, true ) end end addCommandHandler ( "gmoney", pay ) Edited May 4, 2013 by Guest Link to comment
iPrestege Posted May 4, 2013 Share Posted May 4, 2013 Okay i figured out how to get them start but i have a problem with one of these: function pay(player, amount) if( givePlayerMoney ( player, tonumber(amount) ) ) then outputChatBox ("Hai dato dei soldi", source, 255, 255, 255, true ) end end addCommandHandler ( "gmoney", pay ) It says WARNING: commands\script.lua:20: Bad argument @ 'givePlayerMoney' amount = ?? function pay(player) if( givePlayerMoney ( player, 200 ) then outputChatBox ("Hai dato dei soldi", source, 255, 255, 255, true ) end end addCommandHandler ( "gmoney", pay ) Make no sense . Link to comment
فاّرس Posted May 4, 2013 Share Posted May 4, 2013 I do not know what you want he wants for edit or what? Link to comment
iPrestege Posted May 4, 2013 Share Posted May 4, 2013 Use this because the way you are trying to check is wrong : function pay( player ) if ( getPlayerMoney ( player ) == ( 200 ) ) then outputChatBox ( "Hai dato dei soldi",player, 255, 255, 255, true ) end end addCommandHandler ( "gmoney", pay ) Link to comment
فاّرس Posted May 4, 2013 Share Posted May 4, 2013 Use this because the way you are trying to check is wrong : function pay( player ) if ( getPlayerMoney ( player ) == ( 200 ) ) then outputChatBox ( "Hai dato dei soldi",player, 255, 255, 255, true ) end end addCommandHandler ( "gmoney", pay ) He want give not get ! addCommandHandler ( "gmoney", function ( player ) if (givePlayerMoney(player,200)) then outputChatBox ( "I've got a $ 200",player, 255, 255, 255, true ) end end) Link to comment
PaiN^ Posted May 4, 2013 Share Posted May 4, 2013 I think he want's something like this : addCommandHandler ( 'gmoney', function ( player, cmd, amount ) if not tonumber( amount ) then return end local give = givePlayerMoney ( player, amount ) if give then outputChatBox ( 'Hai dato dei soldi', player, 255, 255, 255, true ) end end ) Link to comment
Dante94 Posted May 4, 2013 Author Share Posted May 4, 2013 Thanks "The best" but the problem is, with this command i give a stated amount of money and i want to be able to set the amount i want everytime, also the big problem is the money disappear after i relog on the server so they are only in client side becouse they don't get saved. How can i make it work on server side? Link to comment
iPrestege Posted May 4, 2013 Share Posted May 4, 2013 setAccountData getAccountData isGuestAccount givePlayerMoney onPlayerLogin To save the money to the player account. Link to comment
Dante94 Posted May 4, 2013 Author Share Posted May 4, 2013 Can you give me an example of what i should write to save the money in the player account? i can't figure it out myself... Link to comment
Mega9 Posted May 4, 2013 Share Posted May 4, 2013 addEventHandler ("onPlayerQuit", root, function () local playerAccount = getPlayerAccount (source) local playerMoney = getPlayerMoney (source) setAccountData etc. end ) Just a basic start to give you an idea what to do. Save player's money to account data and then retrieve the account data onPlayerLogin. 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