05.04.2015, 15:38
Hi,
As you know (or don't know
) in some RolePlay servers normal players cannot enter in some special vehicles like some factions vehicles.
I want to ask where should I put my codes that creates limits to players not to enter to the vehicles?
OnPlayerEnterVehicle or OnPlayerStateChange?
And here are some codes that doesn't work in both. (Normal player can get in them and these codes doesn't throw player out of vehicle)
Vehicle define code :
A code that shows is this it a Cop Car or not :
PD Vehicle adding code : (All of them)
OnPlayerStateChange limit code :
OnPlayerEnterVehicle limit code :
There's not any error or something that can be stopped compiling! compiling works and doesn't have any problem!
I'll give a +rep for the best answer
As you know (or don't know
) in some RolePlay servers normal players cannot enter in some special vehicles like some factions vehicles.I want to ask where should I put my codes that creates limits to players not to enter to the vehicles?
OnPlayerEnterVehicle or OnPlayerStateChange?
And here are some codes that doesn't work in both. (Normal player can get in them and these codes doesn't throw player out of vehicle)
Vehicle define code :
Код:
new PoliceVeh[80];
Код:
stock IsACopCar(vehicleid)
{
for(new i=0; i<50; i++)
{
if(vehicleid == PoliceVeh[i]) return 1;
}
return 0;
}
Код:
PoliceVeh[1] = CreateVehicle(523,1585.2291,-1676.4011,5.4624,270.0000,-1,-1,900); //police bike
PoliceVeh[2] = CreateVehicle(523,1585.2291,-1679.0729,5.4607,270.0000,-1,-1,900); //police bike
PoliceVeh[3] = CreateVehicle(596,1583.3301,-1710.1624,5.6129,0,-1,-1,900); //police lspd car
PoliceVeh[4] = CreateVehicle(598,1587.4896,-1710.1624,5.6129,0,-1,-1,900); //police lvpd car
PoliceVeh[5] = CreateVehicle(427,1558.7682,-1710.4094,6.0225,359.5701,-1,-1,900); //police enforcer
PoliceVeh[6] = CreateVehicle(596,1578.5399,-1710.1624,5.6129,0,-1,-1,900); //police lspd car
PoliceVeh[7] = CreateVehicle(596,1574.4989,-1710.1624,5.6129,0,-1,-1,900); //police lspd car
PoliceVeh[8] = CreateVehicle(596,1570.3170,-1710.1624,5.6129,0,-1,-1,900); //police lspd car
PoliceVeh[9] = CreateVehicle(596,1535.7517,-1678.2754,15.0000,0,-1,-1,900); //police lspd car
PoliceVeh[10] = CreateVehicle(497,1549.5,-1644.1257,33.0,90.0,0,1,900); // Roof Chopper
PoliceVeh[11] = CreateVehicle(497,1549.5,-1707.3848,33.0,90.0,0,1,900); // Roof Chopper
PoliceVeh[12] = CreateVehicle(601,1564.4753,-1711.6448,5.6510,5.6801,-1,-1,900); //swat tank
PoliceVeh[13] = CreateVehicle(528,1558.0299,-1694.0360,5.9432,180,-1,-1,900); //swat vehicle
PoliceVeh[14] = CreateVehicle(528,1561.2257,-1694.0164,5.9347,180,-1,-1,900); //swat vehicle 02
PoliceVeh[15] = CreateVehicle(598,1591.4315,-1710.1624,5.6255,0,-1,-1,900); //police lvpd car
PoliceVeh[16] = CreateVehicle(596,1601.8004,-1704.2368,5.6111,90,-1,-1,900); //police lspd car
PoliceVeh[17] = CreateVehicle(596,1601.8004,-1700.1127,5.6111,90,-1,-1,900); //police lspd car
PoliceVeh[18] = CreateVehicle(596,1601.8004,-1696.0378,5.6111,90,-1,-1,900); //police lspd car
PoliceVeh[19] = CreateVehicle(596,1601.8004,-1691.9602,5.6111,90,-1,-1,900); //police lspd car
PoliceVeh[20] = CreateVehicle(599,1585.3041,-1671.7306,6.1209,269.1276,0,1,900); //police rancher car
PoliceVeh[21] = CreateVehicle(599,1585.5951,-1667.6407,6.0218,270.1369,0,1,900); //police rancher car
PoliceVeh[22] = CreateVehicle(598,1601.8846,-1683.9987,5.6107,89.8121,0,1,900); //police lvpd car
PoliceVeh[23] = CreateVehicle(598,1602.0452,-1687.9415,5.6112,90.9819,0,1,900); //police lvpd car
PoliceVeh[24] = CreateVehicle(523,1600.2445,-1711.6592,5.4535,44.0296,0,1,900); //police bike
PoliceVeh[25] = CreateVehicle(523,1602.6547,-1709.4182,5.4535,46.7312,0,1,900); //police bike
PoliceVeh[26] = CreateVehicle(598,1595.4485,-1710.2502,5.6096,359.5797,0,1,900); //police lvpd car
Код:
if(IsPlayerInAnyVehicle(i) && GetPlayerState(i) == PLAYER_STATE_DRIVER)
{
if(IsACopCar(GetPlayerVehicleID(i)))
{
if(PlayerInfo[i][pMember] != 1 && PlayerInfo[i][pMember] != 2 && PlayerInfo[i][pMember] != 3 && !IsAnAgent(i))
{
displayCenterHUDInfo(playerid, "You are not a member of the ~b~Los Santos Police Department~w~!", 8); //display for 8 seconds
PlayerPlaySound(playerid, 1058, 0.0, 0.0, 0.0);
RemovePlayerFromVehicle(i);
}
}
}
Код:
if(IsACopCar(GetPlayerVehicleID(vehicleid)) && !ispassenger)
{
if(PlayerInfo[playerid][pMember] != 1 && PlayerInfo[playerid][pMember] != 2 && PlayerInfo[playerid][pMember] != 3 && !IsAnAgent(playerid))
{
displayCenterHUDInfo(playerid, "You are not a member of the ~b~Los Santos Police Department~w~!", 8); //display for 8 seconds
PlayerPlaySound(playerid, 1058, 0.0, 0.0, 0.0);
ClearAnimations(playerid);
}
}
I'll give a +rep for the best answer


.
