xTravax Posted February 25, 2014 Share 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' " Link to comment
Anubhav Posted February 25, 2014 Share 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) Link to comment
Anubhav Posted February 25, 2014 Share Posted February 25, 2014 No problem. You didn't defined veh thats why. Link to comment
Moderators Citizen Posted February 25, 2014 Moderators Share 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. Link to comment
Anubhav Posted February 25, 2014 Share Posted February 25, 2014 Man!! I fixed the problem and now you posting? Farming Posts~! Link to comment
Moderators Citizen Posted February 25, 2014 Moderators Share Posted February 25, 2014 I just didn't saw your posts. Link to comment
xTravax Posted February 25, 2014 Author Share 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. Link to comment
Moderators Citizen Posted February 25, 2014 Moderators Share 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. 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