xTravax Posted February 25, 2014 Posted February 25, 2014 function vehicle(player,command,id) if (id) then local x,y,z = getElementPosition(player) warpPedIntoVehicle ( player, veh ) else outputChatBox("You need to have vehicle ID!",player,255,0,0) end end addCommandHandler("v",vehicle) " 4:bad argument @ 'warpPedIntoVehicle' "
Anubhav Posted February 25, 2014 Posted February 25, 2014 function vehicle(player,command,id) if (id) then local x,y,z = getElementPosition(player) veh = createVehicle(tonumber(id),x,y,z) warpPedIntoVehicle ( player, veh ) else outputChatBox("You need to have vehicle ID!",player,255,0,0) end end addCommandHandler("v",vehicle)
Anubhav Posted February 25, 2014 Posted February 25, 2014 No problem. You didn't defined veh thats why.
Moderators Citizen Posted February 25, 2014 Moderators Posted February 25, 2014 Ok so first we aren't our slaves, there is a proper way to ask for help which is not dropping the code and write the error (that you didn't completly wrote by the way). If you weren't that lazy, you would read in the error output that the function warpPedIntoVehicle was expecting an element at the 2nd argument and that he got nil instead. It just means veh variable doesn't exist at all ... functions you need to fix this: tonumber createVehicle Nothing else. NOTE: You should have been seen this basic function in the first tutorial on the wiki. Thing you didn't read apparently: https://wiki.multitheftauto.com/wiki/Scr ... troduction EDIT: Ok so it looks like some people doesn't really care to be treated as dogs/machines/slaves over here and the veh variable should be local.
Anubhav Posted February 25, 2014 Posted February 25, 2014 Man!! I fixed the problem and now you posting? Farming Posts~!
Moderators Citizen Posted February 25, 2014 Moderators Posted February 25, 2014 I just didn't saw your posts.
xTravax Posted February 25, 2014 Author Posted February 25, 2014 Ok so first we aren't our slaves, there is a proper way to ask for help which is not dropping the code and write the error (that you didn't completly wrote by the way).If you weren't that lazy, you would read in the error output that the function warpPedIntoVehicle was expecting an element at the 2nd argument and that he got nil instead. It just means veh variable doesn't exist at all ... I Don't think that people on this forum are slaves,the fuck? I just didn't write anything about it because i didn't know what to because its a bit obvious what i was trying to do. also on error output it didn't say anything about 2nd argument,and don't call me lazy for no reason.
Moderators Citizen Posted February 25, 2014 Moderators Posted February 25, 2014 Ok so first we aren't our slaves, there is a proper way to ask for help which is not dropping the code and write the error (that you didn't completly wrote by the way).If you weren't that lazy, you would read in the error output that the function warpPedIntoVehicle was expecting an element at the 2nd argument and that he got nil instead. It just means veh variable doesn't exist at all ... I Don't think that people on this forum are slaves,the ? I just didn't write anything about it because i didn't know what to because its a bit obvious what i was trying to do. also on error output it didn't say anything about 2nd argument,and don't call me lazy for no reason. This is what I call a proper way to ask: "Hello everyone, I have a problem with this script. I'm trying to add a command which spawns a vehicle of the desired model and warp the player into that vehicle. Here is the script:" "And the server gives me this error: " By watching your post, I see that the guy who created the thread was so lazy he didn't even say "hi", we are humans so yeah ... Sorry if it's not what you wanted to show, but that's how I saw it.
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