Quantcast

Jump to content

» «
Photo

C# - New modder on the block (Stuck)

7 replies to this topic
Renegade420
  • Renegade420

    Player Hater

  • Members
  • Joined: 09 Mar 2013

#1

Posted 09 March 2013 - 10:32 AM

Hello guys, I'm currently working a C# script.
I need away to check if a player in multiplayer mode is sitting in the driver seat.

I have tryed a number of things but i'm still having alot of trobble any ideas will be great.

Thank you.

pedro2555
  • pedro2555

    Open Sourcer

  • Members
  • Joined: 02 Sep 2012
  • Portugal

#2

Posted 09 March 2013 - 04:21 PM

Can you please detail a bit more what you've tried ?

Vehicle.GetPedOnSeat(), should return a ped instance, you can then check if it is the Player.

CODE

if (car.GetPedOnSeat(VehicleSeat.Driver) == Player.Character)
{
    // Player is in driver seat
    // TODO: code to react
}


This seems to be the obvious way, but not sure about multiplayer.

Renegade420
  • Renegade420

    Player Hater

  • Members
  • Joined: 09 Mar 2013

#3

Posted 09 March 2013 - 09:02 PM

the code above dosent work.

I'm working on this

CODE

                 else if (GTA.RelationshipGroup.NetworkPlayer_01.Equals(true));
                 {
                     Game.DisplayText("You cant search players!");
                 }


which isn't working.

I'll do more research soon.

pedro2555
  • pedro2555

    Open Sourcer

  • Members
  • Joined: 02 Sep 2012
  • Portugal

#4

Posted 10 March 2013 - 01:42 AM

I can't really get that code, from my view it will never be executed.

Renegade420
  • Renegade420

    Player Hater

  • Members
  • Joined: 09 Mar 2013

#5

Posted 10 March 2013 - 04:27 AM

yeah i know, i forgot to add
CODE

Ped lookup = get.GetPedOnSeat(VehicleSeat.Driver);


in the else if statement.. well i moved on from there and tryed doing a pedtype search

CODE

private bool check_player(Ped ped)
          {
              if (ped.PedType != PedType.Cop)
              {
                  return true;
              }
              else
              {
                  return false;
              }
          }


this didn't work..

so yeah.. I'm pretty stumped on this..

pedro2555
  • pedro2555

    Open Sourcer

  • Members
  • Joined: 02 Sep 2012
  • Portugal

#6

Posted 10 March 2013 - 02:50 PM

Can please confirm me this, I'm going to start working on XinputDotNet right now, maybe I can look into that a bit more.

From all online players, sort out the ones driving vehicles, is that what you're trying to achieve ?

Renegade420
  • Renegade420

    Player Hater

  • Members
  • Joined: 09 Mar 2013

#7

Posted 11 March 2013 - 12:02 AM

QUOTE (pedro2555 @ Sunday, Mar 10 2013, 14:50)
Can please confirm me this, I'm going to start working on XinputDotNet right now, maybe I can look into that a bit more.

From all online players, sort out the ones driving vehicles, is that what you're trying to achieve ?

Yes sounds like your on the right track. I need to workout who is a player and who is a NPC (Ped) in a MP match.

pedro2555
  • pedro2555

    Open Sourcer

  • Members
  • Joined: 02 Sep 2012
  • Portugal

#8

Posted 11 March 2013 - 01:55 PM

QUOTE (Renegade420 @ Monday, Mar 11 2013, 00:02)
QUOTE (pedro2555 @ Sunday, Mar 10 2013, 14:50)
Can please confirm me this, I'm going to start working on XinputDotNet right now, maybe I can look into that a bit more.

From all online players, sort out the ones driving vehicles, is that what you're trying to achieve ?

Yes sounds like your on the right track. I need to workout who is a player and who is a NPC (Ped) in a MP match.

Lol, yes I have tried some things but, distinguish NPC is not as easy as it may sound like.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users