SA-MP Forums Archive
Someone help me... - 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: Someone help me... (/showthread.php?tid=179501)



Someone help me... - martynas - 27.09.2010

Hi,


Is there any way to know who sits in the vehicle near me ?

Like im driver i write : /whosits and it shows me who sit in the co-driver seat ? his or her id ?


Thanks...


Re: Someone help me... - NoobScripter1 - 27.09.2010

Take a look at wiki https://sampwiki.blast.hk/wiki/GetPlayerVehicleSeat


Re: Someone help me... - martynas - 27.09.2010

with this i cant get my seat but how to get if there is anyone on co-driver seat and whats his or her id...


Re: Someone help me... - NoobScripter1 - 27.09.2010

hmm i see you could use player stats like if
pawn Код:
(playerState == PLAYER_STATE_PASSENGER )



Re: Someone help me... - martynas - 27.09.2010

no with this nothing happens... need something different...


Re: Someone help me... - [HiC]TheKiller - 27.09.2010

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp("/whosits", cmdtext, true))
    {
        new Pname[24], str[75];
        new vid = GetPlayerVehicleID(playerid);
        for(new i; i<MAX_PLAYERS; i++) //Replace to foreach if you use that
        {
            if(IsPlayerConnected(i)
            {
                if(GetPlayerVehicleID(i) == vid && GetPlayerVehicleSeat(i) == 1)
                {
                     GetPlayerName(i, Pname, 24);
                     format(str, sizeof(str), "%s is sitting next to you", Pname);
                     SendClientMessage(playerid, /*COLOR*/, str);
                     break;
                 }
             }
        }
        return 1;
    }
    return 0;
}



Re: Someone help me... - martynas - 29.09.2010

Thank you very much TheKiller