Bugged kick-from-vehicle script. - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Bugged kick-from-vehicle script. (
/showthread.php?tid=147499)
Bugged kick-from-vehicle script. -
IcyBlight - 12.05.2010
Someone explain this shit.
I made a script to kick your ass outta other factions' vehicles, however, it only works for some.
Top of script:
pawn Код:
if(newstate == PLAYER_STATE_DRIVER)
{
new vehid = GetPlayerVehicleID(playerid);
pawn Код:
if(vehid == lvfbT1 || vehid == lvfbT2 || vehid == lvfbT3 || vehid == lvfbT4)
{
if(PlayerInfo[playerid][Faction] != 4 || PlayerInfo[playerid][Rank] < 2)
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_RED , "[Faction Vehicle]: LVFB Fire Truck - Rank 2+ only");
return 1;
}
}
This for an instance only kicks you from lvfbT1 (las venturas fire brigade Truck 1), not the others. I tested as Faction 7, Rank 7.
And this one, below, shows the News Vans as News Helicopters:
pawn Код:
if(vehid == lvbc_newschopper)
{
if(PlayerInfo[playerid][Faction] != 5 || PlayerInfo[playerid][Rank] < 3)
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_RED , "[Faction Vehicle]: LVBC News Helicopter - Rank 3+ only");
return 1;
}
}
if(vehid == lvbc_newsvan1 || vehid == lvbc_newsvan2 || vehid == lvbc_newsvan3)
{
if(PlayerInfo[playerid][Faction] != 5 || PlayerInfo[playerid][Rank] < 3)
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_RED , "[Faction Vehicle]: LVBC News Helicopter - Rank 3+ only");
return 1;
}
}
Seriously, what?
Please give me a hand here.
Re: Bugged kick-from-vehicle script. -
Moglizorz. - 12.05.2010
1. How many cop cars will there be?
2. Which car is a cop car? However many lines of code there are with "copcars[?]", is your number of vehicles for number 1.
Код:
copcars[0] = AddStaticVehicle(...)
3. How do you define what is a cop car?
Код:
stock IsCopCar(vehicleid)
{
for(new i=0; i<sizeof(copcars); i++)
{
if(copcars[i] == vehicleid) return 1;
}
return 0;
}
4.
Код:
if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER && IsCopCar(GetPlayerVehicleID(playerid)))
{
SendClientMessage(playerid,0xF08080AA,"You have been ejected.");
RemovePlayerFromVehicle(playerid);
return 1;
}
Tried and tested, any more issues feel free to reply.
Re: Bugged kick-from-vehicle script. -
IcyBlight - 12.05.2010
Lol what?
I don't use the "is a cop car" shit, I give all the cop cars their own seperate array, and check if that array is the car the play is in.
Anyway I fixed it
I made some silly mistakes.