FlyingSpoon Posted August 12, 2015 Share Posted August 12, 2015 function pump_rem ( p, cmd ) if ( exports.global:isPlayerAdvancedSupervisor(p) ) then if not cmd then outputChatBox("SYNTAX: /"..cmd.." [id]", p) else local query_two = mysql:query ( "DELETE FROM fuelpumps WHERE id='"..id.."'") if query_two then outputChatBox("Fuel pump successfully deleted.", p, 0, 255, 0) end end end end addCommandHandler("delpump", pump_rem) Well Idk what I have done, but people createPump, and then it inserts to MySQL with certain ID's. But I want to now make a command so people can delete them certain ID's.. how would I do it? e.g. If person create's pump with ID 1 in MySQL Database, but after want to delete it they do - ./delpump 1 How would I do this please, help! Link to comment
t3wz Posted August 12, 2015 Share Posted August 12, 2015 cmd always will be delpump, you've to add id to the parameters of the pump_ren function (after cmd). function pump_rem ( p, cmd, id ) also you've to check if id is different than nil, if it's a number etc wiki have a well made explanation about parameters, check it. Link to comment
FlyingSpoon Posted August 13, 2015 Author Share Posted August 13, 2015 Didnt work... It just keeps outputting Fuel pump successfully deleted even if I just write ./delpump it just keeps outputting that message Link to comment
FlyingSpoon Posted August 13, 2015 Author Share Posted August 13, 2015 Nvm.. works <3 ty 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