Code don't get out the player in a vehicle
#1

the code don't get out a player in a vehicle if he is in a faction inferior of 12 and superior of 15
there is the all code :
PHP код:
new VehicleUniversity[6]; 
PHP код:
    VehicleUniversity[0] = AddStaticVehicle(431,1243.5908,-1814.1011,13.5219,192.1839,6,6);
    
VehicleUniversity[1] = AddStaticVehicle(431,1253.6360,-1808.4974,13.5206,187.4982,6,6);
    
VehicleUniversity[2] = AddStaticVehicle(479,1262.2723,-1795.9644,13.2041,176.6719,6,6);
    
VehicleUniversity[3] = AddStaticVehicle(479,1268.2578,-1795.9026,13.1933,185.7594,6,6);
    
VehicleUniversity[4] = AddStaticVehicle(479,1274.9191,-1795.9988,13.1908,183.1960,6,6); 
somewhere in public OnPlayerEnterVehicle
PHP код:
else if(IsPlayerInVehicle(playeridVehicleUniversity[0]))
        {
            if(
PlayerInfo[playerid][pFac] < 13 || PlayerInfo[playerid][pFac] > 15)
            {
                new 
Float:pos[3];
                 
GetPlayerPos(playeridpos[0], pos[1], pos[2]);
                
SetPlayerPos(playeridpos[0], pos[1], pos[2]);
                
SendClientMessage(playeridCOLOR_ORANGE" You can't start the engine as it belongs to the University School Staff.");
            }
            else if(
IsPlayerInVehicle(playeridVehicleUniversity[1]))
            {
                if(
PlayerInfo[playerid][pFac] < 13 && PlayerInfo[playerid][pFac] > 15)
                {
                    new 
Float:pos[3];
                       
GetPlayerPos(playeridpos[0], pos[1], pos[2]);
                       
SetPlayerPos(playeridpos[0], pos[1], pos[2]);
                       
SendClientMessage(playeridCOLOR_ORANGE" You can't start the engine as it belongs to the University School Staff.");
                }
            }
               else if(
IsPlayerInVehicle(playeridVehicleUniversity[2]))
              {
                if(
PlayerInfo[playerid][pFac] < 13 && PlayerInfo[playerid][pFac] > 15)
                {
                    new 
Float:pos[3];
                       
GetPlayerPos(playeridpos[0], pos[1], pos[2]);
                       
SetPlayerPos(playeridpos[0], pos[1], pos[2]);
                       
SendClientMessage(playeridCOLOR_ORANGE" You can't start the engine as it belongs to the University School Staff.");
                }
            }
               else if(
IsPlayerInVehicle(playeridVehicleUniversity[3]))
            {
                if(
PlayerInfo[playerid][pFac] < 13 && PlayerInfo[playerid][pFac] > 15)
                {
                    new 
Float:pos[3];
                    
GetPlayerPos(playeridpos[0], pos[1], pos[2]);
                    
SetPlayerPos(playeridpos[0], pos[1], pos[2]);
                    
SendClientMessage(playeridCOLOR_ORANGE" You can't start the engine as it belongs to the University School Staff.");
                }
            }
            else if(
IsPlayerInVehicle(playeridVehicleUniversity[4]))
               {
                  if(
PlayerInfo[playerid][pFac] < 13 && PlayerInfo[playerid][pFac] > 15)
                {
                    new 
Float:pos[3];
                       
GetPlayerPos(playeridpos[0], pos[1], pos[2]);
                       
SetPlayerPos(playeridpos[0], pos[1], pos[2]);
                       
SendClientMessage(playeridCOLOR_ORANGE" You can't start the engine as it belongs to the University School Staff.");
                    }
                }
            }
        } 
thanks for the help you will giving me.
Reply
#2

Hello!

Replace your code with this:
PHP код:
for(new i;i<sizeof(VehicleUniversity);i++)
{
    if(
IsPlayerInVehicle(playerid,VehicleUniversity[i]))
    {
        if(
PlayerInfo[playerid][pFac] < 13 || PlayerInfo[playerid][pFac] > 15)
        {
            new 
Float:Pos[3];
            
GetPlayerPos(playerid,Pos[0],Pos[1],Pos[2]);
            
SetPlayerPos(playerid,Pos[0],Pos[1],Pos[2]);
            
SendClientMessage(playerid,COLOR_ORANGE," You can't start the engine as it belongs to the University School Staff.");
            break;
        }
    }

It's shorter then yours and maybe it will work.
Reply
#3

It's making a lot of errors.
here is the code
PHP код:
public OnPlayerEnterVehicle(playeridvehicleidispassenger)
{
    
SendClientMessage(playeridCOLOR_BLUE"Remember to wear your seatbelt so you don't get fined!(/belt).");
    if(
PlayerInfo[playerid][pCarLic] == 0) return SendClientMessage(playeridCOLOR_ORANGE"You are driving without a license! The police can fine you!");
    if(!
ispassenger)
    {
       if (
g_bIsRobbiz[playerid])
       {
           
DestroyObject(g_robbizBag[playerid]);
       }
       if(
IsDMVCar(vehicleid))
        {
            if(!
LicenseTest[playerid])
            {
                new 
Float:pos[3];
                
GetPlayerPos(playeridpos[0], pos[1], pos[2]);
                
SetPlayerPos(playeridpos[0], pos[1], pos[2]);
                
SendClientMessage(playeridCOLOR_ORANGE"You are not taking a drivers license test.");
            }
            else
            {
                
SendClientMessage(playeridCOLOR_LIGHTBLUE"* GPS: Finish the test by driving through all of the checkpoints on your GPS.");
                
SetPlayerCheckpoint(playerid,959.7175,-1403.0309,13.1974,5);
                
SendClientMessage(playeridCOLOR_RED"If you exit the car your test will be failed and it will have to be re-done.");
            }
        }
        else if(
IsFamVehicle(vehicleid) && Fam[vehicleid] != PlayerInfo[playerid][pFam] && !IsACop(playerid) && !IsADOC(playerid) && !IsASAAF(playerid) && !IsSASD(playerid))
        {
            new 
Float:pos[3];
            
GetPlayerPos(playeridpos[0], pos[1], pos[2]);
            
SetPlayerPos(playeridpos[0], pos[1], pos[2]);
            
SendClientMessage(playeridCOLOR_ORANGE" You can't start the engine as it belongs to a family.");
        }
        else if(
IsLeoVehicle(vehicleid) && PlayerInfo[playerid][pFac] != 1)
        {
            new 
Float:pos[3];
            
GetPlayerPos(playeridpos[0], pos[1], pos[2]);
            
SetPlayerPos(playeridpos[0], pos[1], pos[2]);
            
SendClientMessage(playeridCOLOR_ORANGE" You can't start the engine as it belongs to the LSPD.");
        }
        else if(
IsLSFMDVehicle(vehicleid) && PlayerInfo[playerid][pFac] != 5)
        {
            new 
Float:pos[3];
            
GetPlayerPos(playeridpos[0], pos[1], pos[2]);
            
SetPlayerPos(playeridpos[0], pos[1], pos[2]);
            
SendClientMessage(playeridCOLOR_ORANGE" You can't start the engine as it belongs to the LSFMD.");
        }
        else if(
IsNewsVehicle(vehicleid) && PlayerInfo[playerid][pFac] != 4)
        {
            new 
Float:pos[3];
            
GetPlayerPos(playeridpos[0], pos[1], pos[2]);
            
SetPlayerPos(playeridpos[0], pos[1], pos[2]);
            
SendClientMessage(playeridCOLOR_ORANGE" You can't start the engine as it belongs to the News Agency.");
        }
        else if(
IsFBIVehicle(vehicleid) && PlayerInfo[playerid][pFac] != 6)
        {
            new 
Float:pos[3];
            
GetPlayerPos(playeridpos[0], pos[1], pos[2]);
            
SetPlayerPos(playeridpos[0], pos[1], pos[2]);
            
SendClientMessage(playeridCOLOR_ORANGE" You can't start the engine as it belongs to the FBI.");
        }
        else if(
IsNGVehicle(vehicleid) && PlayerInfo[playerid][pFac] != 7)
        {
            new 
Float:pos[3];
            
GetPlayerPos(playeridpos[0], pos[1], pos[2]);
            
SetPlayerPos(playeridpos[0], pos[1], pos[2]);
            
SendClientMessage(playeridCOLOR_ORANGE" You can't start the engine as it belongs to the NG.");
        }
         else if(
IsRETOVehicle(vehicleid) && PlayerInfo[playerid][pFac] != 9)
        {
            new 
Float:pos[3];
            
GetPlayerPos(playeridpos[0], pos[1], pos[2]);
            
SetPlayerPos(playeridpos[0], pos[1], pos[2]);
            
SendClientMessage(playeridCOLOR_ORANGE" You can't start the engine as it belongs to Rebel's Towing");
        }
        else if(
IsTaxiVehicle(vehicleid) && PlayerInfo[playerid][pFac] != 10)
        {
            new 
Float:pos[3];
            
GetPlayerPos(playeridpos[0], pos[1], pos[2]);
            
SetPlayerPos(playeridpos[0], pos[1], pos[2]);
            
SendClientMessage(playeridCOLOR_ORANGE" You can't start the engine as it belongs to LS Taxi Co");
        }
        else if(
IsTruckerVehicle(vehicleid) && PlayerInfo[playerid][pJob] != JOB_TRUCKER)
        {
            new 
Float:pos[3];
            
GetPlayerPos(playeridpos[0], pos[1], pos[2]);
            
SetPlayerPos(playeridpos[0], pos[1], pos[2]);
            
SendClientMessage(playeridCOLOR_ORANGE" You can't start the engine as it belongs to the Truckers.");
        }
        else if(
IsGovVehicle(vehicleid) && PlayerInfo[playerid][pFac] != 2)
        {
            new 
Float:pos[3];
            
GetPlayerPos(playeridpos[0], pos[1], pos[2]);
            
SetPlayerPos(playeridpos[0], pos[1], pos[2]);
            
SendClientMessage(playeridCOLOR_ORANGE" You can't start the engine as it belongs to the GOV.");
        }
        else if(
IsSAAFVehicle(vehicleid) && PlayerInfo[playerid][pFac] != 11)
        {
            new 
Float:pos[3];
            
GetPlayerPos(playeridpos[0], pos[1], pos[2]);
            
SetPlayerPos(playeridpos[0], pos[1], pos[2]);
            
SendClientMessage(playeridCOLOR_ORANGE" You can't start the engine as it belongs to the SA Air Force.");
        }
        else if(
IsDOCVehicle(vehicleid) && PlayerInfo[playerid][pFac] != 13)
        {
            new 
Float:pos[3];
            
GetPlayerPos(playeridpos[0], pos[1], pos[2]);
            
SetPlayerPos(playeridpos[0], pos[1], pos[2]);
            
SendClientMessage(playeridCOLOR_ORANGE" You can't start the engine as it belongs to the Department Of Correct.");
        }
        else if(
IsSASDVehicle(vehicleid) && PlayerInfo[playerid][pFac] != 8)
        {
            new 
Float:pos[3];
            
GetPlayerPos(playeridpos[0], pos[1], pos[2]);
            
SetPlayerPos(playeridpos[0], pos[1], pos[2]);
            
SendClientMessage(playeridCOLOR_ORANGE" You can't start the engine as it belongs to the San Andreas Sherrif Department.");
        }
        else if(
GetVehicleModel(vehicleid) == 519)
        {
                
SetPlayerVirtualWorld(playeridcellmax-vehicleid);
                
SetPlayerInterior(playerid1);
                
SetPlayerPos(playerid3.83922.9771199.601);
                
SetPlayerFacingAngle(playerid90.0);
                
SetCameraBehindPlayer(playerid);
            }
        return 
1;
    } 
Reply
#4

Put my code after this:
PHP код:
else if(GetVehicleModel(vehicleid) == 519)
{
       
SetPlayerVirtualWorld(playeridcellmax-vehicleid);
       
SetPlayerInterior(playerid1);
       
SetPlayerPos(playerid3.83922.9771199.601);
       
SetPlayerFacingAngle(playerid90.0);
       
SetCameraBehindPlayer(playerid);

Reply
#5

keep the same errors.
Reply
#6

Can you show us the errors?
Reply
#7

it's doing that only when we do an error in a code :
Код:
C:\Users\mickael\Desktop\LGRP\gamemodes\UGRP.pwn(1654) : error 017: undefined symbol "RPN"
C:\Users\mickael\Desktop\LGRP\gamemodes\UGRP.pwn(1655) : error 017: undefined symbol "SendRobberyMessage"
C:\Users\mickael\Desktop\LGRP\gamemodes\UGRP.pwn(1656) : error 017: undefined symbol "SendCopMessage"
C:\Users\mickael\Desktop\LGRP\gamemodes\UGRP.pwn(1674) : error 017: undefined symbol "IsACop"
C:\Users\mickael\Desktop\LGRP\gamemodes\UGRP.pwn(1678) : error 017: undefined symbol "IsACop"
C:\Users\mickael\Desktop\LGRP\gamemodes\UGRP.pwn(1681) : error 017: undefined symbol "GiveDodMoney"
C:\Users\mickael\Desktop\LGRP\gamemodes\UGRP.pwn(1823) : error 017: undefined symbol "IsPlayerLoggedIn"
C:\Users\mickael\Desktop\LGRP\gamemodes\UGRP.pwn(1863) : error 017: undefined symbol "ResetDodWeapons"
C:\Users\mickael\Desktop\LGRP\gamemodes\UGRP.pwn(2813) : error 017: undefined symbol "split"
C:\Users\mickael\Desktop\LGRP\gamemodes\UGRP.pwn(2901) : error 017: undefined symbol "IsPlayerLoggedIn"
C:\Users\mickael\Desktop\LGRP\gamemodes\UGRP.pwn(2906) : error 017: undefined symbol "RPNU"
C:\Users\mickael\Desktop\LGRP\gamemodes\UGRP.pwn(2928) : error 017: undefined symbol "SaveDodAmmo"
C:\Users\mickael\Desktop\LGRP\gamemodes\UGRP.pwn(3164) : error 017: undefined symbol "SaveToys"
C:\Users\mickael\Desktop\LGRP\gamemodes\UGRP.pwn(3183) : error 017: undefined symbol "RPNU"
C:\Users\mickael\Desktop\LGRP\gamemodes\UGRP.pwn(3186) : error 017: undefined symbol "RPNU"
C:\Users\mickael\Desktop\LGRP\gamemodes\UGRP.pwn(3457) : error 017: undefined symbol "LoadToys"
C:\Users\mickael\Desktop\LGRP\gamemodes\UGRP.pwn(3468) : error 017: undefined symbol "RPN"
C:\Users\mickael\Desktop\LGRP\gamemodes\UGRP.pwn(3495) : error 017: undefined symbol "RPN"
C:\Users\mickael\Desktop\LGRP\gamemodes\UGRP.pwn(3496) : error 017: undefined symbol "SendAdminMessage"
C:\Users\mickael\Desktop\LGRP\gamemodes\UGRP.pwn(3499) : error 017: undefined symbol "RPN"
C:\Users\mickael\Desktop\LGRP\gamemodes\UGRP.pwn(3500) : error 017: undefined symbol "SendAdminMessage"
C:\Users\mickael\Desktop\LGRP\gamemodes\UGRP.pwn(3504) : error 017: undefined symbol "RPN"
C:\Users\mickael\Desktop\LGRP\gamemodes\UGRP.pwn(3505) : error 017: undefined symbol "SendAdminMessage"
C:\Users\mickael\Desktop\LGRP\gamemodes\UGRP.pwn(3574) : error 017: undefined symbol "split"
C:\Users\mickael\Desktop\LGRP\gamemodes\UGRP.pwn(3585) : error 017: undefined symbol "GT"
C:\Users\mickael\Desktop\LGRP\gamemodes\UGRP.pwn(3586) : error 017: undefined symbol "GT"

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


26 Errors.
Reply
#8

PHP код:
public OnPlayerEnterVehicle(playeridvehicleidispassenger)
{
    
SendClientMessage(playeridCOLOR_BLUE"Remember to wear your seatbelt so you don't get fined!(/belt).");
    if(
PlayerInfo[playerid][pCarLic] == 0) return SendClientMessage(playeridCOLOR_ORANGE"You are driving without a license! The police can fine you!");
    if(!
ispassenger)
    {
        if (
g_bIsRobbiz[playerid])
        {
            
DestroyObject(g_robbizBag[playerid]);
        }
        if(
IsDMVCar(vehicleid))
        {
            if(!
LicenseTest[playerid])
            {
                new 
Float:pos[3];
                
GetPlayerPos(playeridpos[0], pos[1], pos[2]);
                
SetPlayerPos(playeridpos[0], pos[1], pos[2]);
                
SendClientMessage(playeridCOLOR_ORANGE"You are not taking a drivers license test.");
            }
            else
            {
                
SendClientMessage(playeridCOLOR_LIGHTBLUE"* GPS: Finish the test by driving through all of the checkpoints on your GPS.");
                
SetPlayerCheckpoint(playerid,959.7175,-1403.0309,13.1974,5);
                
SendClientMessage(playeridCOLOR_RED"If you exit the car your test will be failed and it will have to be re-done.");
            }
        }
        else if(
IsFamVehicle(vehicleid) && Fam[vehicleid] != PlayerInfo[playerid][pFam] && !IsACop(playerid) && !IsADOC(playerid) && !IsASAAF(playerid) && !IsSASD(playerid))
        {
            new 
Float:pos[3];
            
GetPlayerPos(playeridpos[0], pos[1], pos[2]);
            
SetPlayerPos(playeridpos[0], pos[1], pos[2]);
            
SendClientMessage(playeridCOLOR_ORANGE" You can't start the engine as it belongs to a family.");
        }
        else if(
IsLeoVehicle(vehicleid) && PlayerInfo[playerid][pFac] != 1)
        {
            new 
Float:pos[3];
            
GetPlayerPos(playeridpos[0], pos[1], pos[2]);
            
SetPlayerPos(playeridpos[0], pos[1], pos[2]);
            
SendClientMessage(playeridCOLOR_ORANGE" You can't start the engine as it belongs to the LSPD.");
        }
        else if(
IsLSFMDVehicle(vehicleid) && PlayerInfo[playerid][pFac] != 5)
        {
            new 
Float:pos[3];
            
GetPlayerPos(playeridpos[0], pos[1], pos[2]);
            
SetPlayerPos(playeridpos[0], pos[1], pos[2]);
            
SendClientMessage(playeridCOLOR_ORANGE" You can't start the engine as it belongs to the LSFMD.");
        }
        else if(
IsNewsVehicle(vehicleid) && PlayerInfo[playerid][pFac] != 4)
        {
            new 
Float:pos[3];
            
GetPlayerPos(playeridpos[0], pos[1], pos[2]);
            
SetPlayerPos(playeridpos[0], pos[1], pos[2]);
            
SendClientMessage(playeridCOLOR_ORANGE" You can't start the engine as it belongs to the News Agency.");
        }
        else if(
IsFBIVehicle(vehicleid) && PlayerInfo[playerid][pFac] != 6)
        {
            new 
Float:pos[3];
            
GetPlayerPos(playeridpos[0], pos[1], pos[2]);
            
SetPlayerPos(playeridpos[0], pos[1], pos[2]);
            
SendClientMessage(playeridCOLOR_ORANGE" You can't start the engine as it belongs to the FBI.");
        }
        else if(
IsNGVehicle(vehicleid) && PlayerInfo[playerid][pFac] != 7)
        {
            new 
Float:pos[3];
            
GetPlayerPos(playeridpos[0], pos[1], pos[2]);
            
SetPlayerPos(playeridpos[0], pos[1], pos[2]);
            
SendClientMessage(playeridCOLOR_ORANGE" You can't start the engine as it belongs to the NG.");
        }
        else if(
IsRETOVehicle(vehicleid) && PlayerInfo[playerid][pFac] != 9)
        {
            new 
Float:pos[3];
            
GetPlayerPos(playeridpos[0], pos[1], pos[2]);
            
SetPlayerPos(playeridpos[0], pos[1], pos[2]);
            
SendClientMessage(playeridCOLOR_ORANGE" You can't start the engine as it belongs to Rebel's Towing");
        }
        else if(
IsTaxiVehicle(vehicleid) && PlayerInfo[playerid][pFac] != 10)
        {
            new 
Float:pos[3];
            
GetPlayerPos(playeridpos[0], pos[1], pos[2]);
            
SetPlayerPos(playeridpos[0], pos[1], pos[2]);
            
SendClientMessage(playeridCOLOR_ORANGE" You can't start the engine as it belongs to LS Taxi Co");
        }
        else if(
IsTruckerVehicle(vehicleid) && PlayerInfo[playerid][pJob] != JOB_TRUCKER)
        {
            new 
Float:pos[3];
            
GetPlayerPos(playeridpos[0], pos[1], pos[2]);
            
SetPlayerPos(playeridpos[0], pos[1], pos[2]);
            
SendClientMessage(playeridCOLOR_ORANGE" You can't start the engine as it belongs to the Truckers.");
        }
        else if(
IsGovVehicle(vehicleid) && PlayerInfo[playerid][pFac] != 2)
        {
            new 
Float:pos[3];
            
GetPlayerPos(playeridpos[0], pos[1], pos[2]);
            
SetPlayerPos(playeridpos[0], pos[1], pos[2]);
            
SendClientMessage(playeridCOLOR_ORANGE" You can't start the engine as it belongs to the GOV.");
        }
        else if(
IsSAAFVehicle(vehicleid) && PlayerInfo[playerid][pFac] != 11)
        {
            new 
Float:pos[3];
            
GetPlayerPos(playeridpos[0], pos[1], pos[2]);
            
SetPlayerPos(playeridpos[0], pos[1], pos[2]);
            
SendClientMessage(playeridCOLOR_ORANGE" You can't start the engine as it belongs to the SA Air Force.");
        }
        else if(
IsDOCVehicle(vehicleid) && PlayerInfo[playerid][pFac] != 13)
        {
            new 
Float:pos[3];
            
GetPlayerPos(playeridpos[0], pos[1], pos[2]);
            
SetPlayerPos(playeridpos[0], pos[1], pos[2]);
            
SendClientMessage(playeridCOLOR_ORANGE" You can't start the engine as it belongs to the Department Of Correct.");
        }
        else if(
IsSASDVehicle(vehicleid) && PlayerInfo[playerid][pFac] != 8)
        {
            new 
Float:pos[3];
            
GetPlayerPos(playeridpos[0], pos[1], pos[2]);
            
SetPlayerPos(playeridpos[0], pos[1], pos[2]);
            
SendClientMessage(playeridCOLOR_ORANGE" You can't start the engine as it belongs to the San Andreas Sherrif Department.");
        }
        else if(
GetVehicleModel(vehicleid) == 519)
        {
            
SetPlayerVirtualWorld(playeridcellmax-vehicleid);
             
SetPlayerInterior(playerid1);
              
SetPlayerPos(playerid3.83922.9771199.601);
               
SetPlayerFacingAngle(playerid90.0);
            
SetCameraBehindPlayer(playerid);
        }
    }
    for(new 
i;i<sizeof(VehicleUniversity);i++)
    {
        if(
IsPlayerInVehicle(playerid,VehicleUniversity[i]))
        {
            if(
PlayerInfo[playerid][pFac] < 13 || PlayerInfo[playerid][pFac] > 15)
            {
                new 
Float:Pos[3];
                
GetPlayerPos(playerid,Pos[0],Pos[1],Pos[2]);
                
SetPlayerPos(playerid,Pos[0],Pos[1],Pos[2]);
                
SendClientMessage(playerid,COLOR_ORANGE," You can't start the engine as it belongs to the University School Staff.");
                break;
            }
        }
    }
    return 
1;

Reply
#9

the code don't get out a player in a vehicle if he is in a faction inferior of 12 and superior of 15
Reply
#10

Quote:
Originally Posted by Eymeric69
Посмотреть сообщение
the code don't get out a player in a vehicle if he is in a faction inferior of 12 and superior of 15
How can a number be lower than 12 and higher than 15 at the same time?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)