Small/Easy Issue -
Harmon - 07.09.2012
Right, I'm trying to fix a little mix up in the script I have and I wanted to change this part of the script
Код:
public OnPlayerEnterVehicle(playerid, vehicleid, 0)
{
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
if(engine == VEHICLE_PARAMS_OFF || engine == VEHICLE_PARAMS_UNSET)
{
SendClientMessage(playerid, COLOR_WHITE,"< To turn on the vehicle engine type {800040}/engine{FFFFFF} - to check radio commands type {800040}/radiohelp{FFFFFF} >");
}
else if(IsAFBICar(vehicleid))
{
if(PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pLeader] == 2 || PlayerInfo[playerid][pMember] == 4 || PlayerInfo[playerid][pLeader] == 4) { }
else { SendClientMessage(playerid,COLOR_GREY," You are not in the FBI"); ClearAnimations(playerid); }
}
else if(IsACopCar(vehicleid))
{
if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1 || PlayerInfo[playerid][pMember] == 3 || PlayerInfo[playerid][pLeader] == 3) { }
else { SendClientMessage(playerid,COLOR_GREY," You are not in the LSPD/SASD !"); ClearAnimations(playerid); }
}
else if(IsANGCar(vehicleid))
{
if(PlayerInfo[playerid][pMember] == 5 || PlayerInfo[playerid][pLeader] == 5) { }
else { SendClientMessage(playerid,COLOR_GREY," You are not in the DoC !"); ClearAnimations(playerid); }
}
else if(IsAnAmbulance(vehicleid))
{
if(PlayerInfo[playerid][pMember] == 4 || PlayerInfo[playerid][pLeader] == 4) { }
else { SendClientMessage(playerid,COLOR_GREY," You are not in the LSFMD !"); ClearAnimations(playerid); }
}
else if(IsANewsCar(vehicleid))
{
if(PlayerInfo[playerid][pMember] == 9 || PlayerInfo[playerid][pLeader] == 9) { }
else { SendClientMessage(playerid,COLOR_GREY," You are not in the news agency !"); ClearAnimations(playerid); }
}
if(vehicleid >= vipCars[0] && vehicleid <= vipCars[39])
{
if(PlayerInfo[playerid][pDonateRank] < 1)
{
SendClientMessage(playerid, -1," You're not a VIP!");
ClearAnimations(playerid);
}
}
if(vehicleid >= rlounge[0] && vehicleid <= rlounge[3])
{
if(PlayerInfo[playerid][pDonateRank] < 1)
{
SendClientMessage(playerid, -1," You're not a VIP!");
ClearAnimations(playerid);
}
}
if(vehicleid >= Trashmaster[0] && vehicleid <= Trashmaster[2])
{
if(PlayerInfo[playerid][pJob] != 11)
{
SendClientMessage(playerid, COLOR_GREY,"You are not a Trashman");
ClearAnimations(playerid);
}
}
if(vehicleid >= MailBike[0] && vehicleid <= MailBike[5])
{
if(PlayerInfo[playerid][pJob] != 22)
{
SendClientMessage(playerid, COLOR_GREY,"You are not a Mail-Man");
ClearAnimations(playerid);
}
}
if(vehicleid >= PizzaBike[0] && vehicleid <= PizzaBike[4])
{
if(PlayerInfo[playerid][pJob] != 20)
{
SendClientMessage(playerid, COLOR_GREY,"You are not a Pizza-Boy");
ClearAnimations(playerid);
}
}
if(vehicleid >= CopVehicle[0] && vehicleid <= CopVehicle[6])
{
if(PlayerInfo[playerid][pMember] != 1)
{
SendClientMessage(playerid, COLOR_WHITE,"You don't have the keys of this vehicle( Faction-vehicle)");
ClearAnimations(playerid);
}
}
return 1;
}
As you can see this code won't let you enter a car if your not in the specific faction, Is there a way to fix it so You cannot enter as a DRIVER unless you are in that faction. This code won't allow passengers no matter how I edit it and how much i read this part of SA-MP WIKI.
https://sampwiki.blast.hk/wiki/OnPlayerEnterVehicle
Re: Small/Easy Issue - Glint - 07.09.2012
Use
OnPlayerStateChange to check if he is a driver or not if he is then don't allow him.
Re: Small/Easy Issue -
Harmon - 07.09.2012
That wasn't exactly what i was looking for.. When a Person that is not in... SASD Faction(Factioin number 3) they cannot enter the vehicles as a passenger... So it has to be edited when the player Attempts to ENTER the vehicle.
Re: Small/Easy Issue -
Harmon - 07.09.2012
gamemodes\DCRP.pwn(7500) : error 010: invalid function or declaration
Thats my Error code... and this is 7500's line.
public OnPlayerEnterVehicle(playerid, vehicleid, 0)
Re: Small/Easy Issue - Glint - 07.09.2012
When you press return or F to enter a vehicle OnPlayerEnterVehicle gets called, even if you are entering it as a passanger, so as i said use OnPlayerStateChange.
Re: Small/Easy Issue -
Harmon - 07.09.2012
So could you give me an example of how to make a few lines with OnPlayerStateChange to allow civilians into the passenger but Whoever is in the faction can be in the passenger and the driver seat. I'm just a beginner so I have no idea how to do this correctly.
Re: Small/Easy Issue -
clarencecuzz - 07.09.2012
Just add
Код:
if(ispassenger == 0)
Will detect if the player is entering as a driver.
ispassenger == 1 will detect entering as a passenger.
https://sampwiki.blast.hk/wiki/OnPlayerEnterVehicle
Re: Small/Easy Issue -
Harmon - 08.09.2012
Here are my errors
(7510) : error 017: undefined symbol "ispassenger"
(7511) : error 029: invalid expression, assumed zero
Line 7505-7515
Код:
else if(IsAFBICar(vehicleid))
{
if(PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pLeader] == 2 || PlayerInfo[playerid][pMember] == 4 || PlayerInfo[playerid][pLeader] == 4) { }
if(ispassenger == 0)
else { SendClientMessage(playerid,COLOR_GREY," You are not in the FBI"); ClearAnimations(playerid); }
}
else if(IsACopCar(vehicleid))
{
if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1 || PlayerInfo[playerid][pMember] == 3 || PlayerInfo[playerid][pLeader] == 3) { }
else { SendClientMessage(playerid,COLOR_GREY," You are not in the LSPD/SASD !"); ClearAnimations(playerid); }
}