Problem with warning on onplayerentervehicle
#1

Why have warning?
warning:
(5203) : warning 211: possibly unintended assignment


Part:
Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{ 
    if(vehicleid = Veh || Veh2 || Veh3 || Veh4 || Veh5 || Veh6 || Veh7 || Veh8 || Veh9 || Veh10 || Veh11)//5203 line
    
    {
        if(PlayerInfo[playerid][pFaction] >= 1)
        { 
            SendClientMessage(playerid, -1, ""COL_CYAN"*"COL_GREY"Usli ste u sluzbeno vozilo.");
        }
    } 
    else 
    {
        SendClientMessage(playerid, -1, ""COL_CYAN"*"COL_GREY"Ne mozete voziti ovo vozilo jer niste u sluzbi.");
        RemovePlayerFromVehicle(playerid); 
    } 
    return 1; 
}
Reply
#2

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if(vehicleid == Veh || Veh2 || Veh3 || Veh4 || Veh5 || Veh6 || Veh7 || Veh8 || Veh9 || Veh10 || Veh11)//5203 line
   
    {
        if(PlayerInfo[playerid][pFaction] >= 1)
        {
            SendClientMessage(playerid, -1, ""COL_CYAN"*"COL_GREY"Usli ste u sluzbeno vozilo.");
        }
    }
    else
    {
        SendClientMessage(playerid, -1, ""COL_CYAN"*"COL_GREY"Ne mozete voziti ovo vozilo jer niste u sluzbi.");
        RemovePlayerFromVehicle(playerid);
    }
    return 1;
}
Reply
#3

Actually, when you have if(, you need to put = two times. ==. Well, you missed it.

Correct code:

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if(vehicleid == Veh || Veh2 || Veh3 || Veh4 || Veh5 || Veh6 || Veh7 || Veh8 || Veh9 || Veh10 || Veh11)
    {
        if(PlayerInfo[playerid][pFaction] >= 1)
        {
            SendClientMessage(playerid, -1, ""COL_CYAN"*"COL_GREY"Usli ste u sluzbeno vozilo.");
        }
    }
    else
    {
        SendClientMessage(playerid, -1, ""COL_CYAN"*"COL_GREY"Ne mozete voziti ovo vozilo jer niste u sluzbi.");
        RemovePlayerFromVehicle(playerid);
    }
    return 1;
}
EDIT: Didn't saw the above guy, sorry. I didn't refreshed page.
Reply
#4

Thanks DaniceMcHarley and HY
Reply
#5

This system not working :/ im not cop and not removing me out of car.


im make this, are its good?

Код:
public OnPlayerUpdate(playerid)
{
    if(IsPlayerInVehicle(playerid, Veh)) // Grabs the vehicle ID
    {
        if(PlayerInfo[playerid][pFaction] != 1) // Grabs their faction
        return RemovePlayerFromVehicle(playerid); // If it isn't 1 (SFPD) it removes you from the vehicle
    }
    if(IsPlayerInVehicle(playerid, Veh)) // Grabs the vehicle ID
    {
        if(PlayerInfo[playerid][pFaction] != 1) // Grabs their faction
        return RemovePlayerFromVehicle(playerid); // If it isn't 1 (SFPD) it removes you from the vehicle
    }
    if(IsPlayerInVehicle(playerid, Veh2)) // Grabs the vehicle ID
    {
        if(PlayerInfo[playerid][pFaction] != 1) // Grabs their faction
        return RemovePlayerFromVehicle(playerid); // If it isn't 1 (SFPD) it removes you from the vehicle
    }
    if(IsPlayerInVehicle(playerid, Veh3)) // Grabs the vehicle ID
    {
        if(PlayerInfo[playerid][pFaction] != 1) // Grabs their faction
        return RemovePlayerFromVehicle(playerid); // If it isn't 1 (SFPD) it removes you from the vehicle
    }
    if(IsPlayerInVehicle(playerid, Veh4)) // Grabs the vehicle ID
    {
        if(PlayerInfo[playerid][pFaction] != 1) // Grabs their faction
        return RemovePlayerFromVehicle(playerid); // If it isn't 1 (SFPD) it removes you from the vehicle
    }
    if(IsPlayerInVehicle(playerid, Veh5)) // Grabs the vehicle ID
    {
        if(PlayerInfo[playerid][pFaction] != 1) // Grabs their faction
        return RemovePlayerFromVehicle(playerid); // If it isn't 1 (SFPD) it removes you from the vehicle
    }
    if(IsPlayerInVehicle(playerid, Veh6)) // Grabs the vehicle ID
    {
        if(PlayerInfo[playerid][pFaction] != 1) // Grabs their faction
        return RemovePlayerFromVehicle(playerid); // If it isn't 1 (SFPD) it removes you from the vehicle
    }
    if(IsPlayerInVehicle(playerid, Veh7)) // Grabs the vehicle ID
    {
        if(PlayerInfo[playerid][pFaction] != 1) // Grabs their faction
        return RemovePlayerFromVehicle(playerid); // If it isn't 1 (SFPD) it removes you from the vehicle
    }
    if(IsPlayerInVehicle(playerid, Veh8)) // Grabs the vehicle ID
    {
        if(PlayerInfo[playerid][pFaction] != 1) // Grabs their faction
        return RemovePlayerFromVehicle(playerid); // If it isn't 1 (SFPD) it removes you from the vehicle
    }
    if(IsPlayerInVehicle(playerid, Veh9)) // Grabs the vehicle ID
    {
        if(PlayerInfo[playerid][pFaction] != 1) // Grabs their faction
        return RemovePlayerFromVehicle(playerid); // If it isn't 1 (SFPD) it removes you from the vehicle
    }
    if(IsPlayerInVehicle(playerid, Veh10)) // Grabs the vehicle ID
    {
        if(PlayerInfo[playerid][pFaction] != 1) // Grabs their faction
        return RemovePlayerFromVehicle(playerid); // If it isn't 1 (SFPD) it removes you from the vehicle
    }
    if(IsPlayerInVehicle(playerid, Veh11)) // Grabs the vehicle ID
    {
        if(PlayerInfo[playerid][pFaction] != 1) // Grabs their faction
        return RemovePlayerFromVehicle(playerid); // If it isn't 1 (SFPD) it removes you from the vehicle
    }
	return 1;
}
Reply
#6

Putting in it OnPlayerUpdate will cause lag
Reply
#7

Quote:
Originally Posted by Dziugsas
Посмотреть сообщение
Putting in it OnPlayerUpdate will cause lag
how to make better system?
Reply
#8

on public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)?
Reply
#9

Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if(vehicleid == Veh || vehicleid == Veh2 || vehicleid == Veh3 || vehicleid == Veh4 || vehicleid == Veh5 || vehicleid == Veh6 || vehicleid == Veh7 || vehicleid == Veh8 || vehicleid == Veh9 || vehicleid == Veh10 || vehicleid == Veh11)
    {
        if(PlayerInfo[playerid][pFaction] >= 1)
        {
            SendClientMessage(playerid, -1, ""COL_CYAN"*"COL_GREY"Usli ste u sluzbeno vozilo.");
        }
    }
    else
    {
        SendClientMessage(playerid, -1, ""COL_CYAN"*"COL_GREY"Ne mozete voziti ovo vozilo jer niste u sluzbi.");
        RemovePlayerFromVehicle(playerid);
    }
    return 1;
}
Reply
#10

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    switch (vehicleid)
    {
        case Veh, Veh2, Veh3, Veh4, Veh5, Veh6, Veh7, Veh8, Veh9, Veh10, Veh11:
        {
            if(PlayerInfo[playerid][pFaction] >= 1)
            {
                SendClientMessage(playerid, -1, ""COL_CYAN"*"COL_GREY"Usli ste u sluzbeno vozilo.");
            }
        }
        default:
        {
            SendClientMessage(playerid, -1, ""COL_CYAN"*"COL_GREY"Ne mozete voziti ovo vozilo jer niste u sluzbi.");
            RemovePlayerFromVehicle(playerid);
        }
    }

    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)