OnPlayerstatechange Problem
#1

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
Reply
#2

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
Reply
#3

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;
}
Reply
#4

Do you want eject or lock?
Reply
#5

I want to eject((RemovePlayerFromVehicle))
Reply
#6

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
Reply
#7

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+
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)