Jump to content

MTA:SA Bug WarpPedIntoVehicle


3B00DG4MER

Recommended Posts

Posted

Hi guys, today I was working on Vehicle and Peds

I tried to warp a ped into a Vehicle

than I tried to enter the vehicle, I was unable to do it

here's a code

it's basic, I think it's MTA:SA Bug

  
x,y,z = getElementPosition(getRandomPlayer()) -- i'm alone at the server , so it's should get me 
veh = createVehicle(411,x,y,z) -- creating the vehicle 
ped = createPed(211,x,y,z) -- creating the ped 
warpPedIntoVehicle(ped,veh) -- Warping Ped into the Vehicle 
addEventHandler("onVehicleStartEnter",root,function() outputChatBox("You are trying to enter a vehicle !") end) -- This event won't get called ! 
  

Note : when I kill the Ped I can enter to the vehicle and the event called

SAF/SAO - 30%

Skype: Themerzoug2020

in-game name:3B00DG4MER

xOG7h1J.png

Posted

That's not bug, it won't get called, because he never "started" to enter the vehicle, you warped him right in. onVehicleEnter should be called.

Lua Scripter

?ucet=miki_cz

Owner of mshost.cz MTA portal.

Posted

Its your bug you should use seat (thirs function argument)

  
 x,y,z = getElementPosition(getRandomPlayer()) -- i'm alone at the server , so it's should get me 
veh = createVehicle(411,x,y,z) -- creating the vehicle 
ped = createPed(211,x,y,z) -- creating the ped 
warpPedIntoVehicle(ped,veh, 1) -- Warping Ped into the Vehicle 
addEventHandler("onVehicleStartEnter",root,function() outputChatBox("You are trying to enter a vehicle !") end) -- This event won't get called ! 
  
  
  

#include <iostream>

int main() {

    std::cout << "C++ is amazing <3" << std::endl;

    return 0;

}

I left MTA !... I m doing some tuts about (servers and scripting here) subscribe please

Posted (edited)

OMG,Why do I've to set the seat while by default it's 0

and the problem is not when Warping the ped

the problem when trying to enter to a vehicle it's has got already a ped( Jacking)

Edited by Guest

SAF/SAO - 30%

Skype: Themerzoug2020

in-game name:3B00DG4MER

xOG7h1J.png

Posted

0 is the driver

#include <iostream>

int main() {

    std::cout << "C++ is amazing <3" << std::endl;

    return 0;

}

I left MTA !... I m doing some tuts about (servers and scripting here) subscribe please

Posted

So ... Just try it please

#include <iostream>

int main() {

    std::cout << "C++ is amazing <3" << std::endl;

    return 0;

}

I left MTA !... I m doing some tuts about (servers and scripting here) subscribe please

Posted

Evean the seat is 1 ??

#include <iostream>

int main() {

    std::cout << "C++ is amazing <3" << std::endl;

    return 0;

}

I left MTA !... I m doing some tuts about (servers and scripting here) subscribe please

Posted

Note: Vehicles (and other elements) created client-side are only seen by the client that created them, aren't synced and players cannot enter them. They are essentially for display only.

You have to read all of the function page

And be sure that you can't mix server and client functions in one file

350x20_FFFFFF_FFFFFF_000000_000000.png

type-460x42_cborder-000000_ctop-222222_cbottom-333333_ctext1-CCCCCC_ctext2-FFCC00_chighlight-FFCC00.png

Posted

This server side script and not client check your meta

#include <iostream>

int main() {

    std::cout << "C++ is amazing <3" << std::endl;

    return 0;

}

I left MTA !... I m doing some tuts about (servers and scripting here) subscribe please

Posted

Warp the player to vehicle too !

#include <iostream>

int main() {

    std::cout << "C++ is amazing <3" << std::endl;

    return 0;

}

I left MTA !... I m doing some tuts about (servers and scripting here) subscribe please

Posted

You talk about the event afaik !!

#include <iostream>

int main() {

    std::cout << "C++ is amazing <3" << std::endl;

    return 0;

}

I left MTA !... I m doing some tuts about (servers and scripting here) subscribe please

  • Moderators
Posted

If the event never gets called, you don't know when you have to warp him in to it. (and yes I tested it)

So no way around it, lets sit back and relax.

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

Posted

The only think I could think of is this this,

setElementPosition:

Attention: Do not use this function to spawn a ped/player. It will cause problems with other functions like warpPedIntoVehicle. Use spawnPlayer and createPed instead.
Now, I know it sounds farfetched but it actually makes sense, you said it worked again after killing the player. (Something that probably will spawn the player the correct way). You may have a look at the function setElementPosition and ho that one is used in your resources.
  • Moderators
Posted
So you say wait until MTA:SA Team fix it ?

Correct.

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

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