Forum: Grand Theft Auto Series Modding - Our GTA Modding Team is the best around. Tutorials & Topics related to modding your GTA games, trophies, and save files! Discuss GTA game modding with the knowledgeable members of PSX-Scene and the Official GTA IV Mod Team.


The above video goes away if you are a member and logged in, so log in now!




 
Would you like to get all the new info from
PSX-Scene in your email each day?




Want to learn more about the team keeping you up to date with the latest scene news?

Read about them now!

Check out our Developer bios, too!

 


User Tag List

Like Tree13Likes

Thread: Network Id's
  

Page 1 of 5 1 2 3 ... LastLast
Results 1 to 10 of 46
  1. #1 Network Id's 
    zorg93's Avatar
    zorg93 is offline Developer
    Join Date
    Jun 2012
    Posts
    257
    Downloads
    0
    Uploads
    0
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Likes Given
    50
    Likes Received
    143
    Just for people trying to get into scripting and wondering why peoples mods can control other peoples cars, heres some functions to do with getting control of cars

    first add these to your natives.h file, they arent all needed for this, but there just a few useful ones added
    Code:
    extern bool REQUEST_CONTROL_OF_NETWORK_ID(int netid);
    extern void GET_PED_FROM_NETWORK_ID(int netid, Ped *ped);
    extern void GET_VEHICLE_FROM_NETWORK_ID(int netid, Vehicle *vehicle);
    extern void GET_OBJECT_FROM_NETWORK_ID(int netid, Object *obj);
    extern void GET_NETWORK_ID_FROM_PED(Ped ped, int *netid);
    extern void GET_NETWORK_ID_FROM_OBJECT(Object obj, int *netid);
    extern void GET_NETWORK_ID_FROM_VEHICLE(Vehicle vehicle, int *netid);
    extern bool DOES_OBJECT_EXIST_WITH_NETWORK_ID(int netid);
    extern bool DOES_VEHICLE_EXIST_WITH_NETWORK_ID(int netid);
    extern bool DOES_PED_EXIST_WITH_NETWORK_ID(int netid);
    extern bool HAS_CONTROL_OF_NETWORK_ID(int netid);
    extern void SET_NETWORK_ID_CAN_MIGRATE(int netid, bool value);
    extern bool IS_NETWORK_SESSION(void);
    extern void SET_NETWORK_ID_EXISTS_ON_ALL_MACHINES(int netid, bool value);
    extern void SET_PED_EXISTS_ON_ALL_MACHINES(Ped ped, bool exists);
    extern void SET_OBJECT_EXISTS_ON_ALL_MACHINES(Object obj, bool exists);
    extern void SET_CAR_EXISTS_ON_ALL_MACHINES(Vehicle vehicle, bool exists);
    extern bool DOES_PLAYER_HAVE_CONTROL_OF_NETWORK_ID(Player player, int netid);
    how i get control of a network id
    Code:
    bool getconrtol(int networkid){
    if (!IS_NETWORK_SESSION())return true; //included so the script will also work offline
    if (HAS_CONTROL_OF_NETWORK_ID(networkid))return true;
    int count;
    while(!HAS_CONTROL_OF_NETWORK_ID(networkid) && count <1000){
    REQUEST_CONTROL_OF_NETWORK_ID(networkid);
    count++;
    WAIT(0);
    }
    return HAS_CONTROL_OF_NETWORK_ID(networkid);
    }
    then to use this on other players cars use this or similar, note im not showing how to get the handle for another players vehicle here(for noobs what pVehicle is)
    Code:
    Vehicle pVehicle;
    int netid;
    GET_NETWORK_ID_FROM_VEHICLE(pVehicle, &netid);
    if (getcontrol(netid)){
    SET_NETWORK_ID_CAN_MIGRATE(netid, 0);//only necessary if you wanna do things that take a while, like apply a force to their car, wait, then delete it or similar
    //insert all the crap stuff you wanna do to it
    SET_CAR_VISIBLE(pVehicle, 0);//just to see it working
    SET_NETWORK_ID_CAN_MIGRATE(netid, 1);//same with line above, if that isnt included, dont include this
    }
    note this will work for ped/object handles, but you cant take control of a players ped using this method, and things like GET_CLOSEST_CHAR dont work for spawned peds and grabbing object handles is rather confusing, but possible. but if you figure it out the natives are pretty similar GET_NETWORK_ID_FROM_OBJECT(object, &netid); GET_NETWORK_ID_FROM_PED(ped, &netid);

    how to protect yourself from this happening to your car, best run on each cycle so it refreshes itself when you get in another car, and lets other people drive the car when you leave it
    Code:
    int vehicle, id, driver, you;
    bool protect;
    void protection(void){
    you = GetPlayerPed();
    	GET_CAR_CHAR_IS_USING(you,&vehicle);
    		if(DOES_VEHICLE_EXIST(vehicle)){
    			if(!protect){
    				GET_DRIVER_OF_CAR(vehicle,&driver);
    				if(driver == you){
    					GET_NETWORK_ID_FROM_VEHICLE(vehicle,&id);
    					if(HAS_CONTROL_OF_NETWORK_ID(id)){
    						SET_NETWORK_ID_CAN_MIGRATE(id,false);
    						protect = true;
    					}
    				}
    			}
    		}
    		else if(protect && HAS_CONTROL_OF_NETWORK_ID(id)){
    			SET_NETWORK_ID_CAN_MIGRATE(id,true);
    			protect = false;			
    		}		
    }
    rather not use that all the time and want to find out who is taking control of your car and trying to abuse their mods instead, use this then which will print the name of the person who has control of a car that you are in the driver seat of
    Code:
    void checkcar(void){
    int vehicle, you = GetPlayerPed(), driver, netid, player;
    GET_CAR_CHAR_IS_USING(you, &vehicle);
    if (!DOES_VEHICLE_EXIST(vehicle))return;
    GET_DRIVER_OF_CAR(vehicle, &driver);
    if (driver != you)return;
    GET_NETWORK_ID_FROM_VEHICLE(vehicle, &netid);
    if (HAS_CONTROL_OF_NETWORK_ID(netid))return;
    for(player=0;player<16;player++){
    if (!IS_NETWORK_PLAYER_ACTIVE(player))continue;
    if (player == you)continue;
    if (DOES_PLAYER_HAVE_CONTROL_OF_NETWORK_ID(player, netid)){
    PRINT_STRING_WITH_TWO_LITERAL_STRINGS_NOW("STRING", GET_PLAYER_NAME(player), " has taken control of your car", 2500, 1);//some people seem to have trouble with this native, i never have but if you do, use the one below instead, it just shows their name, nothing else
    //PRINT_STRING_WITH_LITERAL_STRING_NOW("STRING", GET_PLAYER_NAME(player), 2500, 1);
    return;}
    }
    }
    Reply With Quote  

  2. #2  
    nativesith's Avatar
    nativesith is online now Moderator
    Join Date
    Jun 2011
    Location
    Los Santos
    Posts
    1,363
    Downloads
    12
    Uploads
    7
    Mentioned
    37 Post(s)
    Tagged
    1 Thread(s)
    Likes Given
    962
    Likes Received
    648
    I ave been messin round a lot with this kinda ISH lately...
    Have not done this looks kewl...thanks zorg93
    Reply With Quote  

  3. #3  
    JDMAlex's Avatar
    JDMAlex is offline & developer
    Join Date
    Nov 2010
    Posts
    723
    Downloads
    5
    Uploads
    1
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)
    Likes Given
    190
    Likes Received
    442
    This is good stuff thanks zorg do you mind if I use it in an update for the free online mods?
    Reply With Quote  

  4. #4  
    dudeeitsbrian is offline Member
    Join Date
    Feb 2012
    Posts
    17
    Downloads
    1
    Uploads
    0
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Likes Given
    10
    Likes Received
    4
    good stuff zorg, i appreciate the release

    Quote Originally Posted by JDMAlex View Post
    This is good stuff thanks zorg do you mind if I use it in an update for the free online mods?
    off-topic (but i can't send a pm) - last night i played on xbox live with someone claiming to be you. i highly doubt it was you seeing as it was on xbox, however i thought i'd ask anyway; was that you last night?
    Reply With Quote  

  5. #5  
    zorg93's Avatar
    zorg93 is offline Developer
    Join Date
    Jun 2012
    Posts
    257
    Downloads
    0
    Uploads
    0
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Likes Given
    50
    Likes Received
    143
    Quote Originally Posted by dudeeitsbrian View Post
    good stuff zorg, i appreciate the release


    off-topic (but i can't send a pm) - last night i played on xbox live with someone claiming to be you. i highly doubt it was you seeing as it was on xbox, however i thought i'd ask anyway; was that you last night?
    thanks, use it well

    off topic, i highly doubt jdm would be on xbox or try and contact you there when your on this site
    Reply With Quote  

  6. #6  
    dudeeitsbrian is offline Member
    Join Date
    Feb 2012
    Posts
    17
    Downloads
    1
    Uploads
    0
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Likes Given
    10
    Likes Received
    4
    Quote Originally Posted by zorg93 View Post
    thanks, use it well

    off topic, i highly doubt jdm would be on xbox or try and contact you there when your on this site
    i have already come up with a few fun things to do with people that i'm working on creating right now

    also,
    it wasn't like he was trying to contact me, he accused me of trying to "freeze him" and said when someone tries to freeze him it makes him leave the game. i hadn't tried to freeze him at all so i was arguing with him about how i never tried to freeze anyone, then he just all of a sudden says he's "Alex from psx-scene". i assumed he was talking about JDMAlex, no big deal at all just wondering
    Reply With Quote  

  7. #7  
    Colt's Avatar
    Colt is online now Developer
    Join Date
    Jun 2012
    Posts
    743
    Downloads
    0
    Uploads
    0
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)
    Likes Given
    741
    Likes Received
    225
    Quote Originally Posted by dudeeitsbrian View Post
    i have already come up with a few fun things to do with people that i'm working on creating right now

    also,
    it wasn't like he was trying to contact me, he accused me of trying to "freeze him" and said when someone tries to freeze him it makes him leave the game. i hadn't tried to freeze him at all so i was arguing with him about how i never tried to freeze anyone, then he just all of a sudden says he's "Alex from psx-scene". i assumed he was talking about JDMAlex, no big deal at all just wondering
    What was his Gamertag? I've seen one guy saying he was JDMAlex on his profile not too long ago.
    Reply With Quote  

  8. #8  
    JDMAlex's Avatar
    JDMAlex is offline & developer
    Join Date
    Nov 2010
    Posts
    723
    Downloads
    5
    Uploads
    1
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)
    Likes Given
    190
    Likes Received
    442
    I only have a ps3 , deff not me.

    edit: I used to have one but then sold it to get a ps3
    Last edited by JDMAlex; 09-25-2012 at 04:54 PM.
    dudeeitsbrian likes this.
    Reply With Quote  

  9. #9  
    zorg93's Avatar
    zorg93 is offline Developer
    Join Date
    Jun 2012
    Posts
    257
    Downloads
    0
    Uploads
    0
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Likes Given
    50
    Likes Received
    143
    Quote Originally Posted by JDMAlex View Post
    This is good stuff thanks zorg do you mind if I use it in an update for the free online mods?
    not at all, go crazy with them, anything to make evades rip offs seem a waste of money
    JDMAlex likes this.
    Reply With Quote  

  10. #10  
    JDMAlex's Avatar
    JDMAlex is offline & developer
    Join Date
    Nov 2010
    Posts
    723
    Downloads
    5
    Uploads
    1
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)
    Likes Given
    190
    Likes Received
    442
    amen ^
    W33D x F4STAND and zorg93 like this.
    Reply With Quote  

Page 1 of 5 1 2 3 ... LastLast
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •