Jump to content

Any pro will help with my scipts?


jingzhi

Recommended Posts

Posted

I was trying to make a script for when player go into the marker and it spawns a bike and put the player on the bike at the same time. So i made this script but its not working, when i step into marker, nothing happens, debugscript mode 3 shows nothing. Here is my script :

marker = createMarker(1514.20679,-1657.22742,12.5,"cylinder",1,255,255,255) 
addEventHandler("onMarkerHit",marker, 
function(thePlayer) 
    if getElementType(thePlayer) =="player" then 
    local Vehicle = createVehicle (509,1514.20679,-1657.22742,12.5) 
    warpPedIntoVehicle (thePlayer, Vehicle) 
    end 
end) 
  

Posted
client or server side ?

its server side, and by the way, i found out its only working while you are in a vehicle, then you will be put on a bike

Posted
marker = createMarker(1514.20679,-1657.22742,12.5,"cylinder",1,255,255,255) 
addEventHandler("onMarkerHit",marker, 
function(thePlayer) 
    if getElementType(thePlayer) =="player" then 
        local x,y,z = getElementPosition(thePlayer) 
        local veh = createVehicle (509,x,y,z) 
        warpPedIntoVehicle (thePlayer, veh) 
    end 
end) 

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

Posted
marker = createMarker(1514.20679,-1657.22742,12.5,"cylinder",1,255,255,255) 
addEventHandler("onMarkerHit",marker, 
function(thePlayer) 
    if getElementType(thePlayer) =="player" then 
        local x,y,z = getElementPosition(thePlayer) 
        local veh = createVehicle (509,x,y,z) 
        warpPedIntoVehicle (thePlayer, veh) 
    end 
end) 

Thank you! :) and can you tell me the reason you change "Vehicle" to "veh"?

Posted
marker = createMarker(1514.20679,-1657.22742,12.5,"cylinder",1,255,255,255) 
addEventHandler("onMarkerHit",marker, 
function(thePlayer) 
    if getElementType(thePlayer) =="player" then 
        local x,y,z = getElementPosition(thePlayer) 
        local veh = createVehicle (509,x,y,z) 
        warpPedIntoVehicle (thePlayer, veh) 
    end 
end) 

I have just tested it and it got the same problem with the original

Posted

try this

local marker = createMarker(1514.20679,-1657.22742,12.5,"cylinder",1,255,255,255) 
addEventHandler("onMarkerHit",marker, 
function(thePlayer) 
    if getElementType(thePlayer) =="player" then 
        local x,y,z = getElementPosition(thePlayer) 
        local veh = createVehicle (509,x,y,z) 
        setTimer(warpPedIntoVehicle,100,1,thePlayer,veh) 
    end 
end) 

560x95_FFFFFF_09FF00_050505_000000.png

"Querer não é poder, mas tentar é avançar"!

Posted
try this
local marker = createMarker(1514.20679,-1657.22742,12.5,"cylinder",1,255,255,255) 
addEventHandler("onMarkerHit",marker, 
function(thePlayer) 
    if getElementType(thePlayer) =="player" then 
        local x,y,z = getElementPosition(thePlayer) 
        local veh = createVehicle (509,x,y,z) 
        setTimer(warpPedIntoVehicle,100,1,thePlayer,veh) 
    end 
end) 

I Will try later when I get home, but I wonder how could a timer help :)

Posted

Its not about the delay, neither is related to client/server side, check this:

local marker = createMarker(1514.20679,-1657.22742,12.5,"cylinder",1.2,255,255,255) 
  
function MarkerHit(plr) 
    if getElementType(plr) == "player" then 
        if (isPedInVehicle(plr)) then return end 
        local x, y, z = getElementPosition(plr) 
        local veh = createVehicle(509, x, y, z) 
        warpPedIntoVehicle(plr, veh) 
    end 
end 
addEventHandler("onMarkerHit", marker, MarkerHit) 

Marker size was 1, which made marker's actual size start from slightly lower than ground level by which it didn't detected hitElement. I changed the size to 1.2 + added exception if Player is already in vehicle, function wont proceed.

Posted
Its not about the delay, neither is related to client/server side, check this:
local marker = createMarker(1514.20679,-1657.22742,12.5,"cylinder",1.2,255,255,255) 
  
function MarkerHit(plr) 
    if getElementType(plr) == "player" then 
        if (isPedInVehicle(plr)) then return end 
        local x, y, z = getElementPosition(plr) 
        local veh = createVehicle(509, x, y, z) 
        warpPedIntoVehicle(plr, veh) 
    end 
end 
addEventHandler("onMarkerHit", marker, MarkerHit) 

Marker size was 1, which made marker's actual size start from slightly lower than ground level by which it didn't detected hitElement. I changed the size to 1.2 + added exception if Player is already in vehicle, function wont proceed.

Thank you very much, but will it also fix the problem that it won't put me on a bike when I'm on foot? I will your scripts as soon as I get home.

Posted
When you are "NOT"* on foot? edit line#5 with this:
if (isPedInVehicle(plr)) or (not isPedOnGround(plr)) or (doesPedHaveJetPack(plr)) then return end 

The original problem is, when I'm on foot, it won't put me on a bike, it only will if I'm in a vehicle

Posted
When you are "NOT"* on foot? edit line#5 with this:
if (isPedInVehicle(plr)) or (not isPedOnGround(plr)) or (doesPedHaveJetPack(plr)) then return end 

The original problem is, when I'm on foot, it won't put me on a bike, it only will if I'm in a vehicle

Change Line#5 with this:

if (not isPedInVehicle(plr)) then return end 

Posted

Try /debugscript 3 or debug it with outputChatBox to see what's wrong

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

Posted (edited)
When you are "NOT"* on foot? edit line#5 with this:
if (isPedInVehicle(plr)) or (not isPedOnGround(plr)) or (doesPedHaveJetPack(plr)) then return end 

The original problem is, when I'm on foot, it won't put me on a bike, it only will if I'm in a vehicle

Change Line#5 with this:

if (not isPedInVehicle(plr)) then return end 

But I want the function to be : It put me on a bike if I'm on foot, but it won't if I'm in a vehicle. I'm not sure if I have explained it clear enough, anyways, I will try those as soon as I get home :)

Edited by Guest
Posted
Try /debugscript 3 or debug it with outputChatBox to see what's wrong

Debug script 3 doesn't show any thing, but it just doesn't work unless I'm in a vehicle

Posted
Try /debugscript 3 or debug it with outputChatBox to see what's wrong

Debug body wont show up any message because script didn't had any 'bug'.

But I want the function to be : It put me on a bike if I'm on foot, but it won't if I'm in a vehicle. I'm not sure if I have explained it clear enough, anyways, I will try those as soon as I get home :)

Yea thats what i gave you at very first reply on mine here, but then again you mis-explained it or i misunderstood it, anyways, here is what you want:
local marker = createMarker(1514.20679,-1657.22742,12.5,"cylinder",1.2,255,255,255) 
  
function MarkerHit(plr) 
    if getElementType(plr) == "player" then 
        if (isPedInVehicle(plr)) then return end 
        local x, y, z = getElementPosition(plr) 
        local veh = createVehicle(509, x, y, z) 
        warpPedIntoVehicle(plr, veh) 
    end 
end 
addEventHandler("onMarkerHit", marker, MarkerHit) 

\

This wont spawn vehicle if you are already in a vehicle.

Posted
Try /debugscript 3 or debug it with outputChatBox to see what's wrong

Debug body wont show up any message because script didn't had any 'bug'.

But I want the function to be : It put me on a bike if I'm on foot, but it won't if I'm in a vehicle. I'm not sure if I have explained it clear enough, anyways, I will try those as soon as I get home :)

Yea thats what i gave you at very first reply on mine here, but then again you mis-explained it or i misunderstood it, anyways, here is what you want:
local marker = createMarker(1514.20679,-1657.22742,12.5,"cylinder",1.2,255,255,255) 
  
function MarkerHit(plr) 
    if getElementType(plr) == "player" then 
        if (isPedInVehicle(plr)) then return end 
        local x, y, z = getElementPosition(plr) 
        local veh = createVehicle(509, x, y, z) 
        warpPedIntoVehicle(plr, veh) 
    end 
end 
addEventHandler("onMarkerHit", marker, MarkerHit) 

\

This wont spawn vehicle if you are already in a vehicle.

Thanks a lot :) I have tried it, now it works :)

Posted
Try /debugscript 3 or debug it with outputChatBox to see what's wrong

Debug body wont show up any message because script didn't had any 'bug'.

Read my whole reply.

Try /debugscript 3 or debug it with outputChatBox to see what's wrong

Its oversized, in case you can't see it.

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

Posted

A guy is facing a bug on such trivial thing as "MARKER SIZE" how would he even understand what "DEBUG WITH CHATBOX" is? Also, problem is solved so excuse me @Paradox.

Posted
A guy is facing a bug on such trivial thing as "MARKER SIZE" how would he even understand what "DEBUG WITH CHATBOX" is? Also, problem is solved so excuse me @Paradox.

There.

Also check what warpPedIntoVehicle returns (true or false)

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

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