Vehicle problems
#1

The players in my server cant access cars unless they are cops :S

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    new newcar = GetPlayerVehicleID(playerid);
    if(newstate == PLAYER_STATE_DRIVER)
    {
        if(IsACopCar(newcar))
        {
            if(PlayerInfo[playerid][pMember]==1||PlayerInfo[playerid][pLeader]==1||PlayerInfo[playerid][pMember]==2||PlayerInfo[playerid][pLeader]==2||PlayerInfo[playerid][pMember]==3||PlayerInfo[playerid][pLeader]==3) { }
            else {
            RemovePlayerFromVehicle(playerid);
            }
        }
        if(IsAnEMSCar(newcar))
        {
            if(PlayerInfo[playerid][pMember]==4||PlayerInfo[playerid][pLeader]==4) { }
            else {
            RemovePlayerFromVehicle(playerid);
            }
        }
        if(IsYakuzaCar(newcar))
        {
            if(PlayerInfo[playerid][pMember]==6||PlayerInfo[playerid][pLeader]==6) { }
            else {
            RemovePlayerFromVehicle(playerid);
            }
        }
        if(IsItalianCar(newcar))
        {
            if(PlayerInfo[playerid][pMember]==14||PlayerInfo[playerid][pLeader]==14) { }
            else {
            RemovePlayerFromVehicle(playerid);
            }
        }
    }
    return 1;
}
pawn Код:
public IsACopCar(carid)
{
    if(carid>=1&&carid<=33||carid==70||carid==80||carid>=75||carid<=78)
    {
        return 1;
    }
    return 0;
}
public IsYakuzaCar(carid)
{
    if((carid >= 64 && carid <= 69||carid >= 71 && carid <=74))
    {
        return 1;
    }
    return 0;
}
public IsItalianCar(carid)
{
    if((carid >= 79 && carid <= 87))
    {
        return 1;
    }
    return 0;
}
public IsAnEMSCar(carid)
{
    if(carid>=34&&carid<=46)
    {
        return 1;
    }
    return 0;
}
Reply
#2

Someone please help, im desperate
Reply
#3

pawn Код:
public OnVehicleStreamIn(vehicleid, forplayerid)
{
    if(vehicleid == xxx)//cop vehicle ids here
    {
        if(GetPlayerSkin(forplayerid) != xxx)//copskin ids here
        {
            SetVehicleParamsForPlayer(vehicleid,forplayerid,1,1);
        }
        else
        {
            SetVehicleParamsForPlayer(vehicleid,forplayerid,1,0);
        }
    }
    return 1;
}
Could use GetPlayerTeam instead of checking player skins.
Reply
#4

Could the problem be that they are under OnPlayerStateChange?
Reply
#5

ISSUE FIXED!!!

How it should look:

pawn Код:
public IsACopCar(carid)
{
    if(carid>=1&&carid<=33||carid==70||carid==80||carid>=75 && carid<=78)
    {
        return 1;
    }
    return 0;
}
This is how it looked:

pawn Код:
public IsACopCar(carid)
{
    if(carid>=1&&carid<=33||carid==70||carid==80||carid>=75||carid<=78)
    {
        return 1;
    }
    return 0;
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)