Jump to content
    1. Welcome to GTAForums!

    1. GTANet.com

    1. GTA Online

      1. Los Santos Drug Wars
      2. Updates
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Red Dead Online

      1. Blood Money
      2. Frontier Pursuits
      3. Find Lobbies & Outlaws
      4. Help & Support
    3. Crews

    1. Grand Theft Auto Series

      1. Bugs*
      2. St. Andrews Cathedral
    2. GTA VI

    3. GTA V

      1. Guides & Strategies
      2. Help & Support
    4. GTA IV

      1. The Lost and Damned
      2. The Ballad of Gay Tony
      3. Guides & Strategies
      4. Help & Support
    5. GTA San Andreas

      1. Classic GTA SA
      2. Guides & Strategies
      3. Help & Support
    6. GTA Vice City

      1. Classic GTA VC
      2. Guides & Strategies
      3. Help & Support
    7. GTA III

      1. Classic GTA III
      2. Guides & Strategies
      3. Help & Support
    8. Portable Games

      1. GTA Chinatown Wars
      2. GTA Vice City Stories
      3. GTA Liberty City Stories
    9. Top-Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    1. Red Dead Redemption 2

      1. PC
      2. Help & Support
    2. Red Dead Redemption

    1. GTA Mods

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Red Dead Mods

      1. Documentation
    3. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    4. Featured Mods

      1. Design Your Own Mission
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Rockstar Games

    2. Rockstar Collectors

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Movies & TV
      5. Music
      6. Sports
      7. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    1. Announcements

    2. Support

    3. Suggestions

Identify Current/Last Vehicle Entered


Billsy93
 Share

Recommended Posts

Hello,

 

Basically I am trying to create a script (in C++) whereby the player can easily identify the last car they were in upon exiting the vehicle (running off to do something else). The last vehicle entered will have an arrow above it and will appear as a blip on your map and minimap and will be called "Your Car". If you then go on to enter another vehicle, the previous vehicle will be forgotten and the new vehicle will be classed as your new, current vehicle that you are making use of.

 

I have made quite a start and I'm nearly there, however I'm stuck and seek some help, the main problems are that my compiler (Visual Studio) doesn't like the GetDriverOfCar function and its' parameters as well as the fact I'm unsure as to how to get the vehicle ID of my current car in order to add a blip to it so it can be identified once i've exited the vehicle regarding the AddBlipToCar function.

 

Below is the code I have thus far, any help would be appreciated to get this up and running:

 

 

#include "CustomFiberThread.h"#include "Scripting.h"#include "../ScriptHook/Log.h"#include <windows.h>using namespace Scripting;CustomFiberThread::CustomFiberThread(){SetName("CarOwnership");}void CustomFiberThread::RunScript(){while(IsThreadAlive()){Blip SavedVehicleBlip;int playerIndex = ConvertIntToPlayerIndex(GetPlayerId());Ped ped;GetPlayerChar(playerIndex, &ped);Blip SavedVehicleBlip;Vehicle LastVehicle;Vehicle SavedVehicle;Vehicle CurrentVehicle;   if ((IsCharInAnyCar(GetPlayerPed()) == true) && (GetDriverOfCar(CurrentVehicle, &GetPlayerPed()) == ped)){if (SavedVehicle != false){SetCarAsMissionCar(SavedVehicle, false);SavedVehicleBlip == false;}GetCarCharIsUsing(ped, &CurrentVehicle);StoreCarCharIsInNoSave(playerIndex, &CurrentVehicle);SetCarAsMissionCar(CurrentVehicle, true);AddBlipForCar(GetVehicleModel(), &SavedVehicleBlip);ChangeBlipSprite(SavedVehicleBlip, BLIP_GARAGE);ChangeBlipScale(SavedVehicleBlip, 0.5f);ChangeBlipColour(SavedVehicleBlip, 5); //MagentaSetBlipAsShortRange(SavedVehicleBlip, 1);ChangeBlipNameFromAscii(SavedVehicleBlip, "Your Car");}       if (SavedVehicle != false){SetCarAsMissionCar(CurrentVehicle, false);;RemoveBlip(SavedVehicleBlip);} if ((IsCharInAnyCar(GetPlayerPed()) == true)){LastVehicle = CurrentVehicle;}}}

 

 

Cheers,

 

Billsy

 

Link to comment
Share on other sites

jitsuin666

Ped vehicle and blip are scripthookdotnet classes. For the native with errors check scripting.h and u can see how to use

Link to comment
Share on other sites

 

Ped vehicle and blip are scripthookdotnet classes. For the native with errors check scripting.h and u can see how to use

Yes, I did check scripting.h as some of the native functions I have used had to be added across from scriptingdirty.h but I'm still unsure as to where to go from the code I have and how to go about rectifying the few errors that still remain.

 

Thanks.

Link to comment
Share on other sites

 

Post the method from the header file

What do you mean by this, can you elaborate, do you want me to post some extra information here?

 

Thanks.

Link to comment
Share on other sites

Lord_of_Light

yes i wanted u to post this code:

 

 

static void GetDriverOfCar(Vehicle vehicle, Ped *pPed) { NativeInvoke::Invoke<NATIVE_GET_DRIVER_OF_CAR, ScriptVoid>(vehicle, pPed); }

 

 

i recommend u write this in c#, c++ scripts dont have any performance benefits really and coding it is more a hassle for someone new...

 

c#

 

 

Ped driver = vehicle.GetPedOnSeat(VehicleSeat.Driver);//will crash if vehicle does not exist

 

 

c++

 

 

Vehicle vehicle;//set your vehicle however u do... GetClosestCar, etcPed driver;GetDriverOfCar(vehicle, &driver);

 

 

edit: my bad scripthook has vehicle, ped and blip class like shdn. i thought they were handled differently... i dont use the c++ scripthook wink.gif

Edited by Lord_of_Light
Link to comment
Share on other sites

 

yes i wanted u to post this code:

 

 

static void GetDriverOfCar(Vehicle vehicle, Ped *pPed) { NativeInvoke::Invoke<NATIVE_GET_DRIVER_OF_CAR, ScriptVoid>(vehicle, pPed); }

 

 

i recommend u write this in c#, c++ scripts dont have any performance benefits really and coding it is more a hassle for someone new...

 

c#

 

 

Ped driver = vehicle.GetPedOnSeat(VehicleSeat.Driver);//will crash if vehicle does not exist

 

 

c++

 

 

Vehicle vehicle;//set your vehicle however u do... GetClosestCar, etcPed driver;GetDriverOfCar(vehicle, &driver);

 

 

edit: my bad scripthook has vehicle, ped and blip class like shdn. i thought they were handled differently... i dont use the c++ scripthook wink.gif

Hey,

 

I changed

if ((IsCharInAnyCar(GetPlayerPed()) == true) && (GetDriverOfCar(CurrentVehicle, &GetPlayerPed()) == ped))

to this

if ((IsCharInAnyCar(GetPlayerPed()) == true) && (GetDriverOfCar(CurrentVehicle, &ped)))

as it didn't like the "== true". However, now it still doesn't like the GetDriverOfCar part of the if condition as Visual Studio is saying it needs to be a boolean, how do I code the condition (if statement) correctly in this scenario?

 

Thanks

Link to comment
Share on other sites

Lord_of_Light

your syntax is all wrong your asking if a void function is true or false

 

since your new to programming maybe .net would be better for u to learn and then once u understand .net and how programming works... something like learning c++ will be much easier

 

also the first way of checking if a void function equals a ped is also bad syntax

 

both lines u posted are not valid code

Edited by Lord_of_Light
Link to comment
Share on other sites

Lord_of_Light

 

if ((IsCharInAnyCar(GetPlayerPed()) == true) && (GetDriverOfCar(CurrentVehicle, &GetPlayerPed()) == ped))

 

 

should be

 

 

Ped ped;GetDriverOfCar(CurrentVehicle, &ped)if ((IsCharInAnyCar(GetPlayerPed()) == true) && (GetPlayerPed() == ped))

 

 

try that

 

when u check if values equal each other in an if statement, u need to be comparing same value types and u cant compare functions that return void... since u wont have anything to compare... these functions simply perform a task or process some value

Edited by Lord_of_Light
Link to comment
Share on other sites

Lord_of_Light

hey what u want the script to do im bored ill write if u want?

 

will be in .net because i dont believe in wasting time lol

Link to comment
Share on other sites

Lord_of_Light

 

namespace SaveMyCar{   using System;   using GTA;   public class Main : Script   {       Blip blip;       Vehicle playerVeh;       public Main()       {           Tick += Main_Tick;       }       void Main_Tick(object sender, EventArgs e)       {           if (Game.LocalPlayer.Character.isInVehicle())           {               if (Game.Exists(playerVeh))               {                   if (playerVeh.isRequiredForMission) playerVeh.isRequiredForMission = false;                   if (playerVeh != Game.LocalPlayer.Character.CurrentVehicle) playerVeh = Game.LocalPlayer.Character.CurrentVehicle;               }               else               {                   playerVeh = Game.LocalPlayer.Character.CurrentVehicle;               }               if (Game.Exists(blip)) blip.Delete();           }           else           {               if (Game.Exists(playerVeh) && playerVeh.isDriveable && !playerVeh.isRequiredForMission)               {                   playerVeh.isRequiredForMission = true;                   if (!Game.Exists(blip))                   {                       blip = playerVeh.AttachBlip();                       blip.Name = "Your Car";                       blip.Scale = 0.5f;                       blip.Color = (BlipColor)5;                   }               }           }       }   }}

 

 

.net is much easier to work with, u can see how simple it is to read the script and intellisense is so much better wink.gif

Edited by Lord_of_Light
Link to comment
Share on other sites

namespace SaveMyCar{   using System;   using GTA;   public class Main : Script   {       Blip blip;       Vehicle playerVeh;       public Main()       {           Tick += Main_Tick;       }       void Main_Tick(object sender, EventArgs e)       {           if (Game.LocalPlayer.Character.isInVehicle())           {               if (Game.Exists(playerVeh))               {                   if (playerVeh.isRequiredForMission) playerVeh.isRequiredForMission = false;                   if (playerVeh != Game.LocalPlayer.Character.CurrentVehicle) playerVeh = Game.LocalPlayer.Character.CurrentVehicle;               }               else               {                   playerVeh = Game.LocalPlayer.Character.CurrentVehicle;               }               if (Game.Exists(blip)) blip.Delete();           }           else           {               if (Game.Exists(playerVeh) && playerVeh.isDriveable && !playerVeh.isRequiredForMission)               {                   playerVeh.isRequiredForMission = true;                   if (!Game.Exists(blip))                   {                       blip = playerVeh.AttachBlip();                       blip.Name = "Your Car";                       blip.Scale = 0.5f;                       blip.Color = (BlipColor)5;                   }               }           }       }   }}

 

 

.net is much easier to work with, u can see how simple it is to read the script and intellisense is so much better wink.gif

Hey,

 

Thanks for this Lord, however, it doesn't quite do what I want it to do. When I tried your script, the first car I get in, gets a blip (which is good, as intended). However, if I get in another car, the blip for the first car still exists and doesn't get deleted. I want that to be deleted as the current car gets updated with the new car you are now in and for that to get a blip and so on, updating for every new car you enter. If that makes sense? What part of the code would you change in order for that to come into effect?

 

Cheers.

Link to comment
Share on other sites

Lord_of_Light

 

Hey,

 

Thanks for this Lord, however, it doesn't quite do what I want it to do. When I tried your script, the first car I get in, gets a blip (which is good, as intended). However, if I get in another car, the blip for the first car still exists and doesn't get deleted. I want that to be deleted as the current car gets updated with the new car you are now in and for that to get a blip and so on, updating for every new car you enter. If that makes sense? What part of the code would you change in order for that to come into effect?

 

Cheers.

When I tested entering multiple cars it worked, u donthave 2 scripts installed changing if vehicle is a mission vehicle?? Test my script alone to double check

 

Worked for me but I'll double check later

 

this may help u understand where the bug is coming from...

 

 

namespace SaveMyCar{   using System;   using GTA;   public class Main : Script   {       Blip blip;       Vehicle playerVeh;       public Main()       {           Tick += Main_Tick;       }       //this script manages two different states the player could be in... in a car or on foot       void Main_Tick(object sender, EventArgs e)       {           if (Game.LocalPlayer.Character.isInVehicle())//Player is in vehicle           {               if (Game.Exists(playerVeh))//player car has been saved previously               {                   if (playerVeh.isRequiredForMission) playerVeh.isRequiredForMission = false;//removes save flag from previously saved car which may or may not be the current car the player is in, this script uses the ReqForMission vehicle property as a flag and only set true when exiting the car                   if (playerVeh != Game.LocalPlayer.Character.CurrentVehicle) playerVeh = Game.LocalPlayer.Character.CurrentVehicle;//ensures player's current car is the new car to be saved               }               else//player car not previously saved               {                   playerVeh = Game.LocalPlayer.Character.CurrentVehicle;//this sets the first car player gets into               }               if (Game.Exists(blip)) blip.Delete();//deletes blip this script created so for u to get in another car and this blip not get deleted does not make sense, if in fact your blip isnt being deleted i believe u have a script installed with bad code and f*cking up gta memory, u usually will run into access violation errors that u can see in the console when this happens           }           else//Player is on foot           {               //removed... && playerVeh.isDriveable as i don't think it is necessary on 2nd thought and may confuse things               if (Game.Exists(playerVeh) && !playerVeh.isRequiredForMission)//ensures a player car was saved to vehicle variable and it hasn't already been made a mission car, which is the flag this script relies on               {                   playerVeh.isRequiredForMission = true;                   if (!Game.Exists(blip))                   {                       blip = playerVeh.AttachBlip();                       blip.Name = "Your Car";                       blip.Scale = 0.5f;                       blip.Color = (BlipColor)5;                   }               }           }       }       //so this script just constantly checks for a situation and when it finds it, runs a few lines of code and the following ticks, no code should run       //just walk through my comments and see if u can determine where my logic breaks because i tested and works fine;)   }}

 

 

i kinda don't believe you since i tested last night and after reviewing code i see if u r in a vehicle... a blip will not be created by my script, it will only delete the blip it created before, then when ur on foot it can only create the blip once since the blip once and it even has to get through 2 checks to make another blip so this script can't lose track of the blip it creates... so im thinking u have another issue going on... and it did work perfect for me... read my comments in the script and let me know if it makes sense

 

every single if statement in this script is designed to only be true once for each time a player gets in and out of a vehicle so 99% of the time this script runs it just checks bools that route the script to just constantly return from the tick method

Edited by Lord_of_Light
Link to comment
Share on other sites

Lord_of_Light

ok i had someone else test the script and they said it worked fine... i am thinking u have another script installed messing stuff up

 

user posted image

Link to comment
Share on other sites

PacketOverload_x64bit
ok i had someone else test the script and they said it worked fine... i am thinking u have another script installed messing stuff up

 

user posted image

Need to be careful with this individual. Just on GTAF this individual has had full conversations with himself (IV Coding Thread & ENB Screenshot Thread) using two or more accounts that were created by him for the sole purpose of spamming and getting his hate on. Someone said a while back that he had put a virus in one of his modifications. Scanning with AV is one part, but watch out for scripts from this individual. My 2¢.

 

-Packet

Link to comment
Share on other sites

 

Hey,

 

Thanks for this Lord, however, it doesn't quite do what I want it to do. When I tried your script, the first car I get in, gets a blip (which is good, as intended). However, if I get in another car, the blip for the first car still exists and doesn't get deleted. I want that to be deleted as the current car gets updated with the new car you are now in and for that to get a blip and so on, updating for every new car you enter. If that makes sense? What part of the code would you change in order for that to come into effect?

 

Cheers.

When I tested entering multiple cars it worked, u donthave 2 scripts installed changing if vehicle is a mission vehicle?? Test my script alone to double check

 

Worked for me but I'll double check later

 

this may help u understand where the bug is coming from...

 

 

namespace SaveMyCar{   using System;   using GTA;   public class Main : Script   {       Blip blip;       Vehicle playerVeh;       public Main()       {           Tick += Main_Tick;       }       //this script manages two different states the player could be in... in a car or on foot       void Main_Tick(object sender, EventArgs e)       {           if (Game.LocalPlayer.Character.isInVehicle())//Player is in vehicle           {               if (Game.Exists(playerVeh))//player car has been saved previously               {                   if (playerVeh.isRequiredForMission) playerVeh.isRequiredForMission = false;//removes save flag from previously saved car which may or may not be the current car the player is in, this script uses the ReqForMission vehicle property as a flag and only set true when exiting the car                   if (playerVeh != Game.LocalPlayer.Character.CurrentVehicle) playerVeh = Game.LocalPlayer.Character.CurrentVehicle;//ensures player's current car is the new car to be saved               }               else//player car not previously saved               {                   playerVeh = Game.LocalPlayer.Character.CurrentVehicle;//this sets the first car player gets into               }               if (Game.Exists(blip)) blip.Delete();//deletes blip this script created so for u to get in another car and this blip not get deleted does not make sense, if in fact your blip isnt being deleted i believe u have a script installed with bad code and f*cking up gta memory, u usually will run into access violation errors that u can see in the console when this happens           }           else//Player is on foot           {               //removed... && playerVeh.isDriveable as i don't think it is necessary on 2nd thought and may confuse things               if (Game.Exists(playerVeh) && !playerVeh.isRequiredForMission)//ensures a player car was saved to vehicle variable and it hasn't already been made a mission car, which is the flag this script relies on               {                   playerVeh.isRequiredForMission = true;                   if (!Game.Exists(blip))                   {                       blip = playerVeh.AttachBlip();                       blip.Name = "Your Car";                       blip.Scale = 0.5f;                       blip.Color = (BlipColor)5;                   }               }           }       }       //so this script just constantly checks for a situation and when it finds it, runs a few lines of code and the following ticks, no code should run       //just walk through my comments and see if u can determine where my logic breaks because i tested and works fine;)   }}

 

 

i kinda don't believe you since i tested last night and after reviewing code i see if u r in a vehicle... a blip will not be created by my script, it will only delete the blip it created before, then when ur on foot it can only create the blip once since the blip once and it even has to get through 2 checks to make another blip so this script can't lose track of the blip it creates... so im thinking u have another issue going on... and it did work perfect for me... read my comments in the script and let me know if it makes sense

 

every single if statement in this script is designed to only be true once for each time a player gets in and out of a vehicle so 99% of the time this script runs it just checks bools that route the script to just constantly return from the tick method

This is very strange indeed. I've tried again and uninstalling some others mods, but to no avail. I still get an error message when I get into a second vehicle upon loading the game. The script works fine for the first car, as when a exit the blip is there etc, but when I get into another car, I get an error and the blip from the first doesn't get deleted and updated to the new car when I exit. Here's what the error message is saying.

 

Error during Tick in script 'SaveMyCar.Main':

GTA.NonExistingObjectException: Invalid call to an object that doesn't exist anymore!

at GTA.Blip.Delete()

at SaveMyCar.Main.Main_Tick(Object sender, EventArgs e)

at GTA.Script.TryTick()

at GTA.Script.DoTick()

at GTA.ScriptThread.OnTick()

Link to comment
Share on other sites

girish_is_gay

i believe u have some type of conflict going on being it from another script or maybe u r using 1.0.4 and something in the 0.4.0 scripthook isnt compatable

 

this is the line of code that caused the crash btw

 

 

if (Game.Exists(blip)) blip.Delete();

 

 

The exists part ensures the object exists in memory so it has something to delete. So for it to say yes it exists and then when it deletes a nanosecond (not actual time) later it doesn't exist means u have a memory issue. I believe your using an old scripthook for an older version gta or ur using a script that is using code wrong and putting wrong value types into memory and making gta confused to what is what. So even though it thinks a blip exists, it might be looking at something completely different... this is my guess just based on what ur saying

Link to comment
Share on other sites

i believe u have some type of conflict going on being it from another script or maybe u r using 1.0.4 and something in the 0.4.0 scripthook isnt compatable

 

this is the line of code that caused the crash btw

 

 

if (Game.Exists(blip)) blip.Delete();

 

 

The exists part ensures the object exists in memory so it has something to delete. So for it to say yes it exists and then when it deletes a nanosecond (not actual time) later it doesn't exist means u have a memory issue. I believe your using an old scripthook for an older version gta or ur using a script that is using code wrong and putting wrong value types into memory and making gta confused to what is what. So even though it thinks a blip exists, it might be looking at something completely different... this is my guess just based on what ur saying

Cheers Girish,

 

I solved the issue now, you're right in identifying that it was to do with the blip deletion, the cause of the problem was where the code to delete the blip had been placed within the script. All is well, thanks for the help all.

Link to comment
Share on other sites

girish_is_gay

 

i believe u have some type of conflict going on being it from another script or maybe u r using 1.0.4 and something in the 0.4.0 scripthook isnt compatable

 

this is the line of code that caused the crash btw

 

 

if (Game.Exists(blip)) blip.Delete();

 

 

The exists part ensures the object exists in memory so it has something to delete. So for it to say yes it exists and then when it deletes a nanosecond (not actual time) later it doesn't exist means u have a memory issue. I believe your using an old scripthook for an older version gta or ur using a script that is using code wrong and putting wrong value types into memory and making gta confused to what is what. So even though it thinks a blip exists, it might be looking at something completely different... this is my guess just based on what ur saying

Cheers Girish,

 

I solved the issue now, you're right in identifying that it was to do with the blip deletion, the cause of the problem was where the code to delete the blip had been placed within the script. All is well, thanks for the help all.

so why dont u share what fixed it?

 

and u have been talking to one person... fa**ot mods on here ban me over and over, so u can thank jitsuin, not all

Edited by girish_is_gay
Link to comment
Share on other sites

girish_is_gay
ok i had someone else test the script and they said it worked fine... i am thinking u have another script installed messing stuff up

 

user posted image

Need to be careful with this individual. Just on GTAF this individual has had full conversations with himself (IV Coding Thread & ENB Screenshot Thread) using two or more accounts that were created by him for the sole purpose of spamming and getting his hate on. Someone said a while back that he had put a virus in one of his modifications. Scanning with AV is one part, but watch out for scripts from this individual. My 2¢.

 

-Packet

look at the fear in this one LMAO

Link to comment
Share on other sites

girish_is_gay
Fear vs common sense icon14.gif

more like he is a big fat vagina which is why he is still a virgin at 36 years old... him being a big pussy just repels all pussy away

Link to comment
Share on other sites

This is what I changed the script to and it works. Might have been a script conflict, although I did delete my script folder and try it on its own but the case was still the same. It could have been a C++ mod that was the cause of the problem as they are not placed in the scripts folder, just the main directory. Anyway, this is my version and it works perfectly as intended. Similar to the video posted above:

 

 

namespace SaveMyCar{using System;using System.Windows.Forms;using GTA;public class Main : Script{ Blip blip; Vehicle playerVeh; public Main() { 	Tick += Main_Tick; } void Main_Tick(object sender, EventArgs e) { 	if (Game.LocalPlayer.Character.isInVehicle()) 	{   if (Game.Exists(playerVeh))   {    	playerVeh.isRequiredForMission = false;    	GTA.Native.Function.Call("MARK_CAR_AS_NO_LONGER_NEEDED", playerVeh);       	playerVeh = Game.LocalPlayer.Character.CurrentVehicle;   	if (Game.Exists(blip))   	{     GTA.Native.Function.Call("REMOVE_BLIP", blip);     	}     }   else   {   	playerVeh = Game.LocalPlayer.Character.CurrentVehicle;   } 	} 	else 	{   if ((Game.Exists(playerVeh)) && (!playerVeh.isRequiredForMission))   {   	playerVeh.isRequiredForMission = true;   	if (!Game.Exists(blip))   	{     blip = playerVeh.AttachBlip();     blip.Scale = 0.75f;         GTA.Native.Function.Call("CHANGE_BLIP_SPRITE", blip, 79);      blip.Name = "Your Car";      blip.Color = (BlipColor)5;  	   	}   } 	}

 

 

I will try deleting all mods and trying the original again, just seems very strange.

Link to comment
Share on other sites

Imbaaaaaaaackniggers

ok now i am thinking ur on an older gta iv version since we r both getting different results from same code, i thought i asked before, dont think u mentioned, what version u on??

 

u marking a car no longer needed when already using shdn wrapper is a waste... look:

 

user posted image

 

that is what im doing, look at bottom... no longer needed?

 

user posted image

 

so u dont need that, all u needed to do was move the deleting blip to only when car exists, this is why i think ur on gta 1.0.4 using scripthook 0.4.0 <---Problem (IF NO, THEN UR PC IS A RETARD) So my version of the scripthooks, when Game.Exists was called on blip first time it did not exist and Game.Exists blocked blip.Delete from running. But in ur version of the scripthook where things are obviously different, it allowed the blip.Delete code to run... so for u to come back and say nope im using scripthook 0.5.1 and shdn 1.7.1.7 on gta iv 1.0.7 or eflc i will be shocked.

 

u should avoid using Native.GTA.Function, because if u dont know proper parameters, u can screw gta up, and shdn uses all theses native functions and he did it correct, so use hazardx's code not native.functions.

 

and again u calling remove blip is ame when i call delete blip except my code is "managed" u could say and safe, u dont even know if u need to be using pointers, floats, ints or what?? maybe ur right though wink.gif

 

user posted image

 

see delete calls remove...

 

user posted image

 

so dont use natives, just use code i had before, it will make sure u dont run into Access Violations wink.gif

 

so ur on 1.0.4 right?

Edited by Imbaaaaaaaackniggers
Link to comment
Share on other sites

Strange! No I'm on 1.0.7.0 latest patch for EFLC. I play TBOGT. One more thing, basically I want to display some text when the player is close to the car (very close) and I've got this, but it chucks up an error, something about it can't convert to a vector.

 

 

if (Player.Character.Position.DistanceTo(playerVeh) < 1.0f){      Game.DisplayText("Press Y To Open Car Door");}

 

Link to comment
Share on other sites

 

tell me your scripthook versions... both of them?

[iNFO] GTA IV Script Hook 0.5.1 - © 2009, Aru - Initialized

2013-05-24 15:46:39 - Initializing ScriptHookDotNet v1.7.1.6 BETA (GTA IV version 1.1.2.0)

 

Link to comment
Share on other sites

Imbaaaaaaaackniggers

u should be using v1.7.1.7 beta...

 

https://dl.dropboxusercontent.com/u/5531002...20directory.rar (Hey Packetfa**ot dl this it's a virus)

 

dont worry about packetloser billsy93, he thinks im satan and i scare him lol

 

everything u need for eflc is in there, but u just need the v1.7.1.7 beta in there... i bet if u update, ull even fix onther .net scripts... including mine wink.gif

 

look for print literal string native, that is how u can display text like the game does and ur not using vehicle.Position... that is why, the method says it needs a Vector3 but ur giving it a vehicle wink.gif

 

 

namespace DrugWars{   using System;   using GTA;   using GTA.Native;   class Natives   {       internal static void TaskTempCarAction(Ped ped, Vehicle vehicle, int task, int duration)       {           Function.Call("TASK_CAR_TEMP_ACTION", ped, vehicle, task, duration);       }       internal static void StopPhoneRing()       {           Function.Call("STOP_MOBILE_PHONE_RINGING");       }       internal static void PhoneRing(int id)       {           Function.Call("START_CUSTOM_MOBILE_PHONE_RINGING", id);       }       internal static void SetAnimGroupForPed(Ped ped, string animGroupName)       {           Function.Call("SET_ANIM_GROUP_FOR_CHAR", ped, animGroupName);       }       internal static void SetPedCollision(Ped ped, bool value)       {           Function.Call("SET_CHAR_COLLISION", ped, value);       }       internal static void MarkConvoyCar(Vehicle veh, bool value)       {           Function.Call("MARK_CAR_AS_CONVOY_CAR", veh, value);       }       internal static bool PedInCar(Ped ped)       {           return Function.Call<bool>("IS_CHAR_IN_ANY_CAR", ped);       }       internal static bool IsPedPlayingAnim(Ped ped, string animSet, string animName)       {           return Function.Call<bool>("IS_CHAR_PLAYING_ANIM", ped, animSet, animName);       }       internal static bool PedDamagedByPed(Ped ped, Ped ped2)       {           return Function.Call<bool>("HAS_CHAR_BEEN_DAMAGED_BY_CHAR", ped, ped2);       }       internal static void SetPedSpeedMultiplier(Ped ped, float multiplier)       {           Function.Call("SET_CHAR_ANIM_SPEED_MULTIPLIER", ped, multiplier);       }       internal static void Text(string text, int duration = 2000)       {           Function.Call("PRINT_STRING_WITH_LITERAL_STRING_NOW", "STRING", text, duration, 1);       }       internal static bool PedOnBike(Ped ped)       {           return Function.Call<bool>("IS_CHAR_ON_ANY_BIKE", ped);       }       internal static bool PedSpottedPedInFront(Ped ped, Ped ped2)       {           return Function.Call<bool>("HAS_CHAR_SPOTTED_CHAR_IN_FRONT", ped, ped2);       }       internal static bool PedSpottedPed(Ped ped, Ped ped2)       {           return Function.Call<bool>("HAS_CHAR_SPOTTED_CHAR", ped, ped2);       }       internal static void TriggerMissionCompleteAudio(int value)       {           Function.Call("TRIGGER_MISSION_COMPLETE_AUDIO", value);       }   }}

 

 

this class could be pasted into your code (make sure u change namespace to your project's namespace) and then u can call these natives like...

 

 

Natives.Text("HELLO BILLSY93");

 

 

 

//this is howif (Player.Character.Position.DistanceTo(playerVeh.Position) < 1.0f){     Game.DisplayText("Press Y To Open Car Door");}

 

 

go download visual studio 2012 express and u wont have these issues wink.gif

Edited by Imbaaaaaaaackniggers
Link to comment
Share on other sites

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
 Share

  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.