Swagy Posted June 12, 2017 Share Posted June 12, 2017 Well, this is recent, it was working fine, but now it stopped working, any solution? (arguments are right) no error in debug ! Link to comment
keymetaphore Posted June 12, 2017 Share Posted June 12, 2017 Is the ped spawned with spawnPlayer? Are you using it for ped or a player? If you used setElementPosition to spawn the ped/player, this function will not work and returns false. Show some code. Link to comment
Swagy Posted June 13, 2017 Author Share Posted June 13, 2017 sure function spawn (plr, r,g,b, id, vr,vg,vb,vx,vy,vz,vrot, occ, team, group) if (isElement(vehicles[plr])) then destroyElement(vehicles[plr]) vehicles[plr] = createVehicle(id, vx,vy,vz+2, 0,0,vrot) warpPedIntoVehicle (plr, vehicles[plr]) setVehicleColor(vehicles[plr], vr,vg,vb) triggerClientEvent(plr, "CHGvehicles:close", plr) else vehicles[plr] = createVehicle(id, vx,vy,vz+2, 0,0,vrot) warpPedIntoVehicle(plr, vehicles[plr]) setVehicleColor(vehicles[plr], vr,vg,vb) triggerClientEvent(plr, "CHGvehicles:close", plr) end end addEvent("CHGvehicles:spawn", true) addEventHandler("CHGvehicles:spawn", root, spawn) Link to comment
keymetaphore Posted June 13, 2017 Share Posted June 13, 2017 Where is the table located? Is the table OK? Link to comment
Saml1er Posted June 13, 2017 Share Posted June 13, 2017 function spawn (plr, r,g,b, id, vr,vg,vb,vx,vy,vz,vrot, occ, team, group) if (isElement(vehicles[plr])) then destroyElement(vehicles[plr]) vehicles[plr] = createVehicle(id, vx,vy,vz+2, 0,0,vrot) if (isElement(vehicles[plr])) then outputChatBox ( "1: Vehicle created successfully") else outputChatBox ( "1: Failed to create vehicle") end if warpPedIntoVehicle(plr, vehicles[plr]) == true then outputChatBox ( "1: Successfully wrapped ped into vehicle") else outputChatBox ( "1: warpPedIntoVehicle failed") end setVehicleColor(vehicles[plr], vr,vg,vb) triggerClientEvent(plr, "CHGvehicles:close", plr) else vehicles[plr] = createVehicle(id, vx,vy,vz+2, 0,0,vrot) if (isElement( vehicles[plr])) then outputChatBox ( "2: Vehicle created successfully") else outputChatBox ( "2: Failed to create vehicle") end if warpPedIntoVehicle(plr, vehicles[plr]) == true then outputChatBox ( "2: Successfully wrapped ped into vehicle") else outputChatBox ( "2: warpPedIntoVehicle failed") end setVehicleColor(vehicles[plr], vr,vg,vb) triggerClientEvent(plr, "CHGvehicles:close", plr) end end addEvent("CHGvehicles:spawn", true) addEventHandler("CHGvehicles:spawn", root, spawn) Use this and tell us the output. You just need to learn debugging. You can do it yourself if you check return values of functions in wiki. 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