Jump to content

warpPedIntoVehicle not working !


Swagy

Recommended Posts

Posted

Well, this is recent, it was working fine, but now it stopped working, any solution? (arguments are right) no error in debug !

Posted

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)

 

Posted
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.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...