AddStaticVehicle(525,1897.2861,-1874.5471,13.4254,90.3112,44,51); // AddStaticVehicle(525,1897.3396,-1863.3942,13.5911,90.1349,22,30); // AddStaticVehicle(525,1897.6108,-1868.9780,13.4919,90.9807,36,43); // AddStaticVehicle(525,1897.5637,-1857.8895,13.6275,90.9819,18,20); // AddStaticVehicle(525,1897.2646,-1852.4352,13.7077,90.2574,17,20); //
new mech_vehicles[5]; new Mechanic[MAX_PLAYERS]; mech_vehicles[0] = AddStaticVehicle(525,1897.2861,-1874.5471,13.4254,90.3112,44,51); // mech_vehicles[1] = AddStaticVehicle(525,1897.3396,-1863.3942,13.5911,90.1349,22,30); // mech_vehicles[2] = AddStaticVehicle(525,1897.6108,-1868.9780,13.4919,90.9807,36,43); // mech_vehicles[3] = AddStaticVehicle(525,1897.5637,-1857.8895,13.6275,90.9819,18,20); // mech_vehicles[4] = AddStaticVehicle(525,1897.2646,-1852.4352,13.7077,90.2574,17,20); // public OnPlayerStateChange(playerid, newstate, oldstate) { new vid; new Float:X, Float:Y, Float:Z, Float:Angle; GetPlayerPos(playerid,X,Y,Z); GetPlayerFacingAngle(playerid,Angle); vid = GetPlayerVehicleID(playerid); if(oldstate != PLAYER_STATE_DRIVER && newstate == PLAYER_STATE_DRIVER) // Player entered a vehicle as a driver { if(Mechanic[playerid] == 1) return 1; // if the player is mechanic then return 1 If not then check player's vehicle else { for(new i = 0; i< 5; i++) { if(vid == mech_vehicle[i]) { SetPlayerPos(playerid,X,Y,Z+3); SetPlayerFacingAngle(playerid,Angle); SendClientMessage(playerid, 0xFFFFFFFF, "This vehicle is only for Mechanics"); } } } } return 1; }
Show the Error of your Pawno Compiler.
Here is the code of only mechanic can enter in mechanic vehicle. Код:
new mech_vehicles[5]; new Mechanic[MAX_PLAYERS]; mech_vehicles[0] = AddStaticVehicle(525,1897.2861,-1874.5471,13.4254,90.3112,44,51); // mech_vehicles[1] = AddStaticVehicle(525,1897.3396,-1863.3942,13.5911,90.1349,22,30); // mech_vehicles[2] = AddStaticVehicle(525,1897.6108,-1868.9780,13.4919,90.9807,36,43); // mech_vehicles[3] = AddStaticVehicle(525,1897.5637,-1857.8895,13.6275,90.9819,18,20); // mech_vehicles[4] = AddStaticVehicle(525,1897.2646,-1852.4352,13.7077,90.2574,17,20); // public OnPlayerStateChange(playerid, newstate, oldstate) { new vid; new Float:X, Float:Y, Float:Z, Float:Angle; GetPlayerPos(playerid,X,Y,Z); GetPlayerFacingAngle(playerid,Angle); vid = GetPlayerVehicleID(playerid); if(oldstate != PLAYER_STATE_DRIVER && newstate == PLAYER_STATE_DRIVER) // Player entered a vehicle as a driver { if(Mechanic[playerid] == 1) return 1; // if the player is mechanic then return 1 If not then check player's vehicle else { for(new i = 0; i< 5; i++) { if(vid == mech_vehicle[i]) { SetPlayerPos(playerid,X,Y,Z+3); SetPlayerFacingAngle(playerid,Angle); SendClientMessage(playerid, 0xFFFFFFFF, "This vehicle is only for Mechanics"); } } } } return 1; } |
C:\Users\Zach\Desktop\Folders\Servers\SAMP\SamZach\gamemodes\rp.pwn(878) : error 017: undefined symbol "mech_vehicle" C:\Users\Zach\Desktop\Folders\Servers\SAMP\SamZach\gamemodes\rp.pwn(878) : warning 215: expression has no effect C:\Users\Zach\Desktop\Folders\Servers\SAMP\SamZach\gamemodes\rp.pwn(878) : error 001: expected token: ";", but found "]" C:\Users\Zach\Desktop\Folders\Servers\SAMP\SamZach\gamemodes\rp.pwn(878) : error 029: invalid expression, assumed zero C:\Users\Zach\Desktop\Folders\Servers\SAMP\SamZach\gamemodes\rp.pwn(878) : fatal error 107: too many error messages on one line
new MechVehicles[ 5 ];
new Mechanic[MAX_PLAYERS];
MechVehicles[0] = AddStaticVehicleEx(525,1897.2861,-1874.5471,13.4254,90.3112,44,51); //
MechVehicles[1] = AddStaticVehicleEx(525,1897.3396,-1863.3942,13.5911,90.1349,22,30); //
MechVehicles[2] = AddStaticVehicleEx(525,1897.6108,-1868.9780,13.4919,90.9807,36,43); //
MechVehicles[3] = AddStaticVehicleEx(525,1897.5637,-1857.8895,13.6275,90.9819,18,20); //
MechVehicles[4] = AddStaticVehicleEx(525,1897.2646,-1852.4352,13.7077,90.2574,17,20); //
public OnPlayerStateChange(playerid, newstate, oldstate)
{
new vid;
new Float:X, Float:Y, Float:Z, Float:Angle;
GetPlayerPos(playerid,X,Y,Z);
GetPlayerFacingAngle(playerid,Angle);
vid = GetPlayerVehicleID(playerid);
if(oldstate != PLAYER_STATE_DRIVER && newstate == PLAYER_STATE_DRIVER) // Player entered a vehicle as a driver
{
// if(Mechanic[playerid] == 1) return 1; // if the player is mechanic then return 1 If not then check player's vehicle
if(Mechanic[playerid] == 1) { return 1; }// use this if first one error
else
{
for(new i = 0; i< 5; i++)
{
if(vid == MechVehicles[i])
{
SetPlayerPos(playerid,X,Y,Z+3);
SetPlayerFacingAngle(playerid,Angle);
SendClientMessage(playerid, 0xFFFFFFFF, "This vehicle is only for Mechanics");
}
}
}
}
return 1;
}