This code doesn't work. (except IsACopCar and IsTruckerCar) Does it have any problem?
PHP код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
new Float:x, Float:y, Float:z;
if(GetPlayerSurfingVehicleID(playerid) == vehicleid)
{
new Float:hp;
GetPlayerHealth(playerid,hp);
GetPlayerPos(playerid, x, y, z);
if(!PlayerInfo[playerid][pMask]) format(string, sizeof(string), "* %s slipped off the top of the vehicle and fell.", PlayerRPName(playerid));
else format(string, sizeof(string), "* Gharibe slipped off the top of the vehicle and fell.");
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
SetPlayerPos(playerid, x+3, y+3, z+1);
SetPlayerHealth(playerid,hp-3);
PlayerPlaySound(playerid, 1130, 0.0, 0.0, 0.0);
LoopingAnim(playerid,"PED","BIKE_fallR",4.0,0,1,1,1,0);
}
if(!ispassenger)
{
if(IsACopCar(vehicleid))
{
if(!IsACop(playerid))
{
displayCenterHUDInfo(playerid, "You are not a member of the~n~~b~LSPD/FBI/SAST~w~.", 8); //display for 8 seconds
PlayerPlaySound(playerid, 1058, 0.0, 0.0, 0.0);
ClearAnimations(playerid);
}
}
else if(IsTruckerCar(vehicleid))
{
if(PlayerInfo[playerid][pJob] != 18)
{
displayCenterHUDInfo(playerid, "You are not a~n~~r~Trucker Driver~w~.", 8); //display for 8 seconds
PlayerPlaySound(playerid, 1058, 0.0, 0.0, 0.0);
ClearAnimations(playerid);
}
else
{
CP[playerid] = CHECKPOINT_TRUCKERLOAD;
SetPlayerCheckpoint(playerid,1037.4570,-1105.8281,23.9771,4);
}
}
else if(IsADLTCar(vehicleid))
{
if(IsPlayerGivingDTest[playerid] == 0)
{
displayCenterHUDInfo(playerid, "Shoma hazineye Test ra pardakht nakardid!", 8); //display for 8 seconds
PlayerPlaySound(playerid, 1058, 0.0, 0.0, 0.0);
ClearAnimations(playerid);
}
else
{
CP[playerid] = CHECKPOINT_DLTSTART;
SetPlayerCheckpoint(playerid,1700.4584,-1589.6927,13.3699,4);
}
}
else if(IsANGCar(vehicleid))
{
if(!IsANG(playerid))
{
displayCenterHUDInfo(playerid, "You are not a member of the~n~~g~National Guard~w~.", 8); //display for 8 seconds
PlayerPlaySound(playerid, 1058, 0.0, 0.0, 0.0);
ClearAnimations(playerid);
}
}
else if(IsAFBICar(vehicleid))
{
if(!IsAFBI(playerid))
{
displayCenterHUDInfo(playerid, "You are not a member of the~n~~b~FBI~w~.", 8); //display for 8 seconds
PlayerPlaySound(playerid, 1058, 0.0, 0.0, 0.0);
ClearAnimations(playerid);
}
}
else if(IsATaxiCar(vehicleid) || IsABus(vehicleid))
{
if(PlayerInfo[playerid][pMember] != 10 && PlayerInfo[playerid][pJob] != 14)
{
displayCenterHUDInfo(playerid, "You are not a~n~~y~Taxi Driver~w~.", 8); //display for 8 seconds
PlayerPlaySound(playerid, 1058, 0.0, 0.0, 0.0);
GetPlayerPos(playerid, x, y, z);
SetPlayerPos(playerid, x, y, z);
}
}
else if(IsANewsCar(vehicleid))
{
if(PlayerInfo[playerid][pMember] != 9 && !IsAnAgent(playerid))
{
displayCenterHUDInfo(playerid, "You are not a member of the~n~~b~News Agency~w~.", 8); //display for 8 seconds
PlayerPlaySound(playerid, 1058, 0.0, 0.0, 0.0);
GetPlayerPos(playerid, x, y, z);
SetPlayerPos(playerid, x, y, z);
}
}
else if(IsAnAmbulance(vehicleid))
{
if(PlayerInfo[playerid][pMember] != 4 && !IsAnAgent(playerid))
{
displayCenterHUDInfo(playerid, "You are not a member of the~n~~r~LSMFD~w~.", 8); //display for 8 seconds
PlayerPlaySound(playerid, 1058, 0.0, 0.0, 0.0);
GetPlayerPos(playerid, x, y, z);
SetPlayerPos(playerid, x, y, z);
}
}
else if(IsAVipCar(vehicleid))
{
if(IsABronzeCar(vehicleid) && PlayerInfo[playerid][pDonateRank] <= 0)
{
displayCenterHUDInfo(playerid, "~w~You are not a~n~~y~Bronze ~p~VIP~w~.", 8); //display for 8 seconds
PlayerPlaySound(playerid, 1058, 0.0, 0.0, 0.0);
GetPlayerPos(playerid, x, y, z);
SetPlayerPos(playerid, x, y, z);
}
if(IsASilverCar(vehicleid) && PlayerInfo[playerid][pDonateRank] <= 1)
{
displayCenterHUDInfo(playerid, "~w~You are not a ~b~~h~~h~~h~Silver ~p~VIP~w~.", 8); //display for 8 seconds
PlayerPlaySound(playerid, 1058, 0.0, 0.0, 0.0);
GetPlayerPos(playerid, x, y, z);
SetPlayerPos(playerid, x, y, z);
}
if(IsAGoldCar(vehicleid) && PlayerInfo[playerid][pDonateRank] <= 2)
{
displayCenterHUDInfo(playerid, "~w~You are not a~n~~y~Gold ~p~VIP~w~.", 8); //display for 8 seconds
PlayerPlaySound(playerid, 1058, 0.0, 0.0, 0.0);
GetPlayerPos(playerid, x, y, z);
SetPlayerPos(playerid, x, y, z);
}
}
else if(RapidResKitActive[playerid] == 1)
{
if(!ispassenger || ispassenger)
{
SendClientMessage(playerid, COLOR_GREY, "You can't enter a vehicle while using a rapid response kit, '/droprrk' in order to drop it.");
PlayerPlaySound(playerid, 1058, 0.0, 0.0, 0.0);
GetPlayerPos(playerid, x, y, z);
SetPlayerPos(playerid, x, y, z);
}
}
for(new i = 0; i < 4; i++)
{
if(FacInfo[6][fCars][i] == vehicleid)
{
if(!IsASenate(playerid) && !IsAnAgent(playerid))
{
displayCenterHUDInfo(playerid, "You are not a member of the~n~~r~Senate~w~.", 8); //display for 8 seconds
PlayerPlaySound(playerid, 1058, 0.0, 0.0, 0.0);
GetPlayerPos(playerid, x, y, z);
SetPlayerPos(playerid, x, y, z);
}
}
}
}
new Model = GetVehicleModel(vehicleid);
if(Model == 427 && !ispassenger)
{
GetPlayerArmour(playerid, StoreArmour[playerid]);
}
else if(PlayerTied[playerid] != 0) { ClearAnimations(playerid); }
else if(PlayerCuffed[playerid] != 0) { ClearAnimations(playerid); }
else if(PlayerFrozen[playerid] != 0) { ClearAnimations(playerid); }
else if(RapidResKitActive[playerid] != 0) { ClearAnimations(playerid); }
else if(PlayerJustDied[playerid] != 0) { ClearAnimations(playerid); }
return 1;
}
Can you provide us some more details about functions you use in that callback, such as IsTruckerCar and so...
From this peace of code i can't see where is the problem.
Try with adding debug messages under every if statement so you can see where is you script failing...
And about player's Membership , There's not any problem.
And also about Array sizes , There's not any problem again ... (As I said on Skype)
Age old problem with godfather edits because it relies completely on assumptions. Basically, if you add vehicles anywhere but at the end of the list, your gamemode will royally screw up.
It's so weired to me.
This code looks works properly but it's not ...
It seems no one can't help ...
Nobody gives a fuck because you are just using a downloaded script. Scripting help is for people who know how to script and have a problem not for people to fix downloaded gamemodes ask the person who released the gamemode to help you.
If I knew who released this shit ...
And also , If you don't know something about how to fix it, Please get out and stop spamming and let helpers breath to think how to fix it. Ok buddy?
EDIT : I'm not that bad in scripting.
If It was a normal problem, You're right. But just check my code! This shit's strange!