23.04.2014, 17:26
(
Последний раз редактировалось Nathan_Taylor; 23.04.2014 в 22:48.
)
Moved the messages up above the faction check
Trying to figure out why the message wether or not you have a license is only coming up if you try to enter a vehicle that you aren't allowed to enter because you aren't in their faction. If I make a new user with no faction or whatnot, and try to enter a police car, both messages are shown, however, if I try to enter any random vehicle, nothing comes up at all. It is probably some small stupid mistake but I'm not seeing anything.
Trying to figure out why the message wether or not you have a license is only coming up if you try to enter a vehicle that you aren't allowed to enter because you aren't in their faction. If I make a new user with no faction or whatnot, and try to enter a police car, both messages are shown, however, if I try to enter any random vehicle, nothing comes up at all. It is probably some small stupid mistake but I'm not seeing anything.
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if(!ispassenger){
if(pInfo[playerid][Admin] < 2){
//get vehicle id
new vid;
new factionrequired[5] = "None";
vid = GetVehicleModel(vehicleid);
//check for factions
for(new i = 0; i < sizeof(LSPDvehicles); i++)
{
if(vid == LSPDvehicles[i])
{
factionrequired = "LSPD";
break;
}
else if(vid == LSFDvehicles[i])
{
factionrequired = "LSFD";
break;
}
else if(vid == taxivehicles[i])
{
factionrequired = "taxi";
break;
}
}
if(strcmp(pInfo[playerid][Faction], factionrequired, true) != 0)
{
new error[128];
format(error, sizeof(error), "You are not part of the %s faction", factionrequired);
SendClientMessage(playerid, COLOR_LIGHTPINK, error);
ClearAnimations(playerid);
}
}
if(pInfo[playerid][License] == 0){
SendClientMessage(playerid, COLOR_LIGHTPINK, "WARNING: You are driving without a license");
} else if(pInfo[playerid][License] == 1){
SendClientMessage(playerid, COLOR_GREEN, "You have a drivers license!");
} else {
SendClientMessage(playerid, COLOR_YELLOW, "OTHER ERROR");
}
}
return 1;
}