SA-MP Forums Archive
OnPlayerstatechange Problem - 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)
+--- Thread: OnPlayerstatechange Problem (/showthread.php?tid=312035)



OnPlayerstatechange Problem - rati555 - 19.01.2012

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    new newcar = GetPlayerVehicleID(playerid);
    if(newstate == PLAYER_STATE_DRIVER)
    {
        if(VehicleInfo[newcar][vMember] == gTeam[playerid] && VehicleInfo[newcar][vRank] <= pInfo[playerid][pRank])
        {

            SendClientMessage(playerid,COLOR_RED,"You can't drive this car");
            RemovePlayerFromVehicle(playerid);
        }
    }
    return 1;
}
I want to make that if gTeam == VMember doesn't eject player from vehicle but it happens on the contrary


Re: OnPlayerstatechange Problem - mineralo - 19.01.2012

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    new newcar = GetPlayerVehicleID(playerid);
    if(newstate == PLAYER_STATE_DRIVER)
    {
        if(VehicleInfo[newcar][vMember] == gTeam[playerid] && VehicleInfo[newcar][vRank] <= pInfo[playerid][pRank])
        {
            if(gTeam != VMember)
            {
            SendClientMessage(playerid,COLOR_RED,"You can't drive this car");
            RemovePlayerFromVehicle(playerid);
            return 1;
            }
        }
    }
    return 1;
}
try this


Re: OnPlayerstatechange Problem - rati555 - 19.01.2012

Quote:
Originally Posted by mineralo
Посмотреть сообщение
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    new newcar = GetPlayerVehicleID(playerid);
    if(newstate == PLAYER_STATE_DRIVER)
    {
        if(VehicleInfo[newcar][vMember] == gTeam[playerid] && VehicleInfo[newcar][vRank] <= pInfo[playerid][pRank])
        {
            if(gTeam != VMember)
            {
            SendClientMessage(playerid,COLOR_RED,"You can't drive this car");
            RemovePlayerFromVehicle(playerid);
            return 1;
            }
        }
    }
    return 1;
}
try this
tried this and error:
Код:
error 017: undefined symbol "VMember"
also I tried this but everywhone can enter car
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    new newcar = GetPlayerVehicleID(playerid);
    if(newstate == PLAYER_STATE_DRIVER)
    {
        if(VehicleInfo[newcar][vMember] == gTeam[playerid] && VehicleInfo[newcar][vRank] <= pInfo[playerid][pRank])
        {
            if(gTeam[playerid] != VehicleInfo[newcar][vMember])
            {
            SendClientMessage(playerid,COLOR_RED,"You can't drive this car");
            RemovePlayerFromVehicle(playerid);
            return 1;
            }
        }
    }
    return 1;
}



Re: OnPlayerstatechange Problem - sameer419 - 19.01.2012

Do you want eject or lock?


Re: OnPlayerstatechange Problem - rati555 - 19.01.2012

I want to eject((RemovePlayerFromVehicle))


Re: OnPlayerstatechange Problem - [ABK]Antonio - 19.01.2012

pawn Код:
if(VehicleInfo[newcar][vMember] != gTeam[playerid] || pInfo[playerid][pRank] < VehicleInfo[newcar][vRank])
Are you trying to do something like this? This would make it so if they aren't part of the gTeam or if they aren't the correct rank we'll boot them out


Re: OnPlayerstatechange Problem - rati555 - 19.01.2012

Quote:
Originally Posted by [ABK]Antonio
Посмотреть сообщение
pawn Код:
if(VehicleInfo[newcar][vMember] != gTeam[playerid] || pInfo[playerid][pRank] < VehicleInfo[newcar][vRank])
Are you trying to do something like this? This would make it so if they aren't part of the gTeam or if they aren't the correct rank we'll boot them out
thanks it worked rep+