What wrong?
#1

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if(!ispassenger && GetVehicleModel(vehicleid) == 525)
{
    if(GetPlayerSkin(playerid) != 50)
        ClearAnimations(playerid);
    return 1;
}
if(!ispassenger && GetVehicleModel(vehicleid) == 596)
{
    if(GetPlayerSkin(playerid) != 282)
        ClearAnimations(playerid);
}
if(!ispassenger && GetVehicleModel(vehicleid) == 596)
{
    if(GetPlayerSkin(playerid) != 283)
        ClearAnimations(playerid);
}
if(!ispassenger && GetVehicleModel(vehicleid) == 596)
{
    if(GetPlayerSkin(playerid) != 281)
        ClearAnimations(playerid);
}
if(!ispassenger && GetVehicleModel(vehicleid) == 597)
{
    if(GetPlayerSkin(playerid) != 282)
        ClearAnimations(playerid);
}
if(!ispassenger && GetVehicleModel(vehicleid) == 597)
{
    if(GetPlayerSkin(playerid) != 283)
        ClearAnimations(playerid);
}
if(!ispassenger && GetVehicleModel(vehicleid) == 597)
{
    if(GetPlayerSkin(playerid) != 281)
        ClearAnimations(playerid);
}
if(!ispassenger && GetVehicleModel(vehicleid) == 597)
{
    if(GetPlayerSkin(playerid) != 288)
        ClearAnimations(playerid);
}
if(!ispassenger && GetVehicleModel(vehicleid) == 598)
{
    if(GetPlayerSkin(playerid) != 282)
        ClearAnimations(playerid);
}
if(!ispassenger && GetVehicleModel(vehicleid) == 598)
{
    if(GetPlayerSkin(playerid) != 281)
        ClearAnimations(playerid);
}
if(!ispassenger && GetVehicleModel(vehicleid) == 598)
{
    if(GetPlayerSkin(playerid) != 283)
        ClearAnimations(playerid);
}
if(!ispassenger && GetVehicleModel(vehicleid) == 598)
{
    if(GetPlayerSkin(playerid) != 288)
        ClearAnimations(playerid);
}
if(!ispassenger && GetVehicleModel(vehicleid) == 490)
{
    if(GetPlayerSkin(playerid) != 282)
        ClearAnimations(playerid);
}
if(!ispassenger && GetVehicleModel(vehicleid) == 490)
{
    if(GetPlayerSkin(playerid) != 281)
        ClearAnimations(playerid);
}
if(!ispassenger && GetVehicleModel(vehicleid) == 490)
{
    if(GetPlayerSkin(playerid) != 288)
        ClearAnimations(playerid);
}if(!ispassenger && GetVehicleModel(vehicleid) == 490)
{
    if(GetPlayerSkin(playerid) != 283)
        ClearAnimations(playerid);
}
if(!ispassenger && GetVehicleModel(vehicleid) == 427)
{
    if(GetPlayerSkin(playerid) != 282)
        ClearAnimations(playerid);
}if(!ispassenger && GetVehicleModel(vehicleid) == 427)
{
    if(GetPlayerSkin(playerid) != 283)
        ClearAnimations(playerid);
}if(!ispassenger && GetVehicleModel(vehicleid) == 427)
{
    if(GetPlayerSkin(playerid) != 288)
        ClearAnimations(playerid);
}if(!ispassenger && GetVehicleModel(vehicleid) == 427)
{
    if(GetPlayerSkin(playerid) != 281)
        ClearAnimations(playerid);
}
    return 1;
}
I cant enter the vehicle if i got the skin i got no errors by compiling...please help
Reply
#2

Each if statement is evaluated, so once the condition is true the code within the local scope is executed. If false, the check is then passed to the next statement and continues until a check if verified. Code optimization referrers to altering code, to make it more efficient for use. I've made a minor optimization to your code. Since each one of your if statements contains an if(!ispassenger) check, it may be called once. This allows multiple checks without reference to that specific check.


pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if(!ispassenger)
    {
        if(GetVehicleModel(vehicleid) == 525) if(GetPlayerSkin(playerid) != 50)
        if(GetVehicleModel(vehicleid) == 596) if(GetPlayerSkin(playerid) != 282 || GetPlayerSkin(playerid) != 283 || GetPlayerSkin(playerid) != 281)
        if(GetVehicleModel(vehicleid) == 597) if(GetPlayerSkin(playerid) != 282 || GetPlayerSkin(playerid) != 283 || GetPlayerSkin(playerid) != 281 || GetPlayerSkin(playerid) != 288)
        if(GetVehicleModel(vehicleid) == 598) if(GetPlayerSkin(playerid) != 282 || GetPlayerSkin(playerid) != 283 || GetPlayerSkin(playerid) != 281 || GetPlayerSkin(playerid) != 288)
        if(GetVehicleModel(vehicleid) == 490) if(GetPlayerSkin(playerid) != 282 || GetPlayerSkin(playerid) != 281 || GetPlayerSkin(playerid) != 288 || GetPlayerSkin(playerid) != 283)
        if(GetVehicleModel(vehicleid) == 427) if(GetPlayerSkin(playerid) != 282 || GetPlayerSkin(playerid) != 283 || GetPlayerSkin(playerid) != 288 || GetPlayerSkin(playerid) != 281)
        ClearAnimations(playerid);
    }
    return true;
}
Quote:
Originally Posted by Gooday
Посмотреть сообщение
I cant enter the vehicle if i got the skin i got no errors by compiling...please help
You must be in a vehicle and skin other than the id's listed.
Reply
#3

Still not working
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)