SA-MP Forums Archive
PutPlayerInAmptyVehicleSeat(VehicleId, PlayerId) - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: PutPlayerInAmptyVehicleSeat(VehicleId, PlayerId) (/showthread.php?tid=274578)



PutPlayerInAmptyVehicleSeat(VehicleId, PlayerId) - wouter0100 - 06.08.2011

Hey,

Is there a function like that? (Title)

Thanks!


Re: PutPlayerInAmptyVehicleSeat(VehicleId, PlayerId) - Tom1412 - 06.08.2011

hi, what do you want this command for??


Re: PutPlayerInAmptyVehicleSeat(VehicleId, PlayerId) - wouter0100 - 06.08.2011

It isnt a command, a function, for detaining (put a cuffed player) in an empty vehicle seat where the police is in, i use now PutPlayerInVehicle but thats not very stabel when there are more players in the car.


Re: PutPlayerInAmptyVehicleSeat(VehicleId, PlayerId) - Tom1412 - 06.08.2011

Yeah, I use PutPlayerInVehicle on my server. I think that they only is PutPlayerInVehicle. i may post back after talking to some other scripters


Re: PutPlayerInAmptyVehicleSeat(VehicleId, PlayerId) - wouter0100 - 06.08.2011

I now there isnt a function like that, but how can i make it?


Re: PutPlayerInAmptyVehicleSeat(VehicleId, PlayerId) - Tigerkiller - 06.08.2011

GetVehicleSeat(vid,seat);


i dont test it but i think it works

pawn Код:
stock youfuncnamme(playerid,player)
{
new vid,seats,count;
GetVehicleID(playerid,vid);
GetVehicleSeats(vid,seats);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(GetPlayerVehicleID(i) == vid)
{
count++;
}
if(count == 4) return 0;
PutPlayerInVehicle(player,vid,seats);
}
}
return 1;
}
youfuncname(cop,player);

i dont know it is work


Re: PutPlayerInAmptyVehicleSeat(VehicleId, PlayerId) - =WoR=Varth - 06.08.2011

pawn Код:
stock youfuncnamme(vehicleid,playerid)
{
    new bool:Seat[4];
    for(new i;i<MAX_PLAYERS;i++)
    {
        if(IsPlayerConnected(i))
        {
            if(IsPlayerInVehicle(i,vehicleid))
            {
                if(GetPlayerVehicleSeat(i) == 0) Seat[0] = true;
                if(GetPlayerVehicleSeat(i) == 1) Seat[1] = true;
                if(GetPlayerVehicleSeat(i) == 2) Seat[2] = true;
                if(GetPlayerVehicleSeat(i) == 3) Seat[3] = true;
            }
        }
    }
    for(new a;a<sizeof(Seat);i++)
    {
        if(Seat[a] == false) PutPlayerInVehicle(playerid,vehicleid,a);
    }
    return 1;
}



Re: PutPlayerInAmptyVehicleSeat(VehicleId, PlayerId) - Tigerkiller - 06.08.2011

ahh ty in my code i forgot to get seats using loop ty ^^


Re: PutPlayerInAmptyVehicleSeat(VehicleId, PlayerId) - wouter0100 - 06.08.2011

Thanks works now.
1 error, but it was a mistake.
Код:
public PutPlayerInEmptyVehicleSeat(vehicleid,playerid)
{
    new bool:Seat[4];
    for(new i;i<MAX_PLAYERS;i++)
    {
        if(IsPlayerConnected(i))
        {
            if(IsPlayerInVehicle(i,vehicleid))
            {
                if(GetPlayerVehicleSeat(i) == 0) Seat[0] = true;
                if(GetPlayerVehicleSeat(i) == 1) Seat[1] = true;
                if(GetPlayerVehicleSeat(i) == 2) Seat[2] = true;
                if(GetPlayerVehicleSeat(i) == 3) Seat[3] = true;
            }
        }
    }
    for(new a;a<sizeof(Seat);i++)
    {
        if(Seat[a] == false) PutPlayerInVehicle(playerid,vehicleid,a);
    }
    return 1;
}
Good:
Код:
public PutPlayerInEmptyVehicleSeat(vehicleid,playerid)
{
    new bool:Seat[4];
    for(new i;i<MAX_PLAYERS;i++)
    {
        if(IsPlayerConnected(i))
        {
            if(IsPlayerInVehicle(i,vehicleid))
            {
                if(GetPlayerVehicleSeat(i) == 0) Seat[0] = true;
                if(GetPlayerVehicleSeat(i) == 1) Seat[1] = true;
                if(GetPlayerVehicleSeat(i) == 2) Seat[2] = true;
                if(GetPlayerVehicleSeat(i) == 3) Seat[3] = true;
            }
        }
    }
    for(new a;a<sizeof(Seat);a++)
    {
        if(Seat[a] == false) PutPlayerInVehicle(playerid,vehicleid,a);
    }
    return 1;
}
Thanks!


Re: PutPlayerInAmptyVehicleSeat(VehicleId, PlayerId) - andrew4699 - 06.08.2011

Works nicely.