[Question] Looking for vehicle function.
#1

Dear SAMP:er's

I'm creating radio system for vehicle's and are looking for a function to get playerid's of those who are inside the same vehicles as the guy changing radio, any ideas how?

-Sincerely,
Tony
Reply
#2

GetPlayerVehicleSeat

pawn Код:
if(strcmp(cmdtext, "/myseat", true) == 0)
{
    new szString[14], iSeat = GetPlayerVehicleSeat(playerid);
 
    if(iSeat == 128) return SendClientMessage(playerid, 0xFFFFFFFF, "An error has prevented us from returning the seat ID.");
 
    format(szString, sizeof(szString), "Your seat: %i", iSeat);
    SendClientMessage(playerid, 0xFFFFFFFF, szString);
    return 1;
}
Reply
#3

It's kinda easy.
Well you can get the player's car ID and then make a loop to check if there are another players in the same car and to be a little bit better make a variable "persinthecar"(example) and everytime he found a person in the same car persinthecar++; when persinthecar reaches 3 use the function break;
Be careful to avoid in the loop the player who changed the radio: "if(playerid != i)"

It will look like:
pawn Код:
new persinthecar,newcar;
newcar = GetPlayerVehicleID(playerid);
for(new i=0;i<MAX_PLAYERS;i++)
{
 if(playerid != i)
 {
  if(newcar == GetPlayerVehicleID(i))
  {
    //Change the stream....
  }
 }
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)