I can not enter in the car
#1

I created a vehicle for my faction National Guard and when I enter the server can not get in the car!
Code:
PHP код:
new ngCar1;
public 
OnGameModeInit()
{
        
ngCar1 AddStaticVehicle(430,798.3718000,-1984.0696000,0.3073000,-1.9200000,1,-1); //Predator
        
return 1;
}
public 
OnPlayerStateChange(playeridnewstateoldstate)
{
    if(
newstate == PLAYER_STATE_DRIVER)
    {
        new 
newcar GetPlayerVehicleID(playerid);
        if(
newcar == ngCar1)
        {
            if(
PlayerInfo[playerid][pMember] == || PlayerInfo[playerid][pLeader] == 3) { }
            else
            {
                
SendClientMessage(playerid,COLOR_TRIADS,"You are not a member/leader NG !");
                
RemovePlayerFromVehicle(playerid);
            }
        }
        return 
1;

Reply
#2

Try this and tell me if this works

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    new newcar = GetPlayerVehicleID(playerid);
    if(newstate == PLAYER_STATE_DRIVER)
    {
        if(newcar == ngCar1)
        {
            if(PlayerInfo[playerid][pMember] != 3 || PlayerInfo[playerid][pLeader] != 3)
                return SendClientMessage(playerid, COLOR_TRIADS,"You are not a member/leader NG !");
            if(PlayerInfo[playerid][pMember] == 3 || PlayerInfo[playerid][pLeader] == 3) return 1;
        }
    }
    return 1;
}
Reply
#3

I will try now
Reply
#4

Did it work mate
Reply
#5

Quote:
Originally Posted by pds2012
Посмотреть сообщение
Try this and tell me if this works

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    new newcar = GetPlayerVehicleID(playerid);
    if(newstate == PLAYER_STATE_DRIVER)
    {
        if(newcar == ngCar1)
        {
            if(PlayerInfo[playerid][pMember] != 3 || PlayerInfo[playerid][pLeader] != 3)
                return SendClientMessage(playerid, COLOR_TRIADS,"You are not a member/leader NG !");
            if(PlayerInfo[playerid][pMember] == 3 || PlayerInfo[playerid][pLeader] == 3) return 1;
        }
    }
    return 1;
}
He don't work
Reply
#6

Quote:
Originally Posted by radiobizza
Посмотреть сообщение
I created a vehicle for my faction National Guard and when I enter the server can not get in the car!
Code:
PHP код:
new ngCar1;
public 
OnGameModeInit()
{
        
ngCar1 AddStaticVehicle(430,798.3718000,-1984.0696000,0.3073000,-1.9200000,1,-1); //Predator
        
return 1;
}
public 
OnPlayerStateChange(playeridnewstateoldstate)
{
    if(
newstate == PLAYER_STATE_DRIVER)
    {
        new 
newcar GetPlayerVehicleID(playerid);
        if(
newcar == ngCar1)
        {
            if(
PlayerInfo[playerid][pMember] == || PlayerInfo[playerid][pLeader] == 3) { }
            else
            {
                
SendClientMessage(playerid,COLOR_TRIADS,"You are not a member/leader NG !");
                
RemovePlayerFromVehicle(playerid);
            }
        }
        return 
1;

Are you sure your pMember or pLeader is equal to 3?
Reply
#7

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
Are you sure your pMember or pLeader is equal to 3?
Yeah
Reply
#8

Even though it says you're not. Debug it!
pawn Код:
new ngCar1;

public OnGameModeInit()
{
        ngCar1 = AddStaticVehicle(430,798.3718000,-1984.0696000,0.3073000,-1.9200000,1,-1); //Predator
        return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER)
    {
        new newcar = GetPlayerVehicleID(playerid);
        if(newcar == ngCar1)
        {
            printf("pMember: %d and pLeader: %d", PlayerInfo[playerid][pMember], PlayerInfo[playerid][pLeader]);
            if(PlayerInfo[playerid][pMember] == 3 || PlayerInfo[playerid][pLeader] == 3) { }
            else
            {
                SendClientMessage(playerid,COLOR_TRIADS,"You are not a member/leader NG !");
                RemovePlayerFromVehicle(playerid);
            }
        }
        return 1;
}
Show us what it prints to the console/server log.
Reply
#9

I tried to understand what are you doing but because of broken syntax (you are missing an } and spaces are wrongly pointed) I can guess the code isn't full thus the problem might be somewhere else? But give a try to this.


PHP код:
public OnGameModeInit() 

    
ngCar1 AddStaticVehicle(430,798.3718000,-1984.0696000,0.3073000,-1.9200000,1,-1); //Predator 
    
return 1

public 
OnPlayerStateChange(playeridnewstateoldstate
{
    if(
newstate != PLAYER_STATE_DRIVER)
        return 
1;
    if(
GetPlayerVehicleID(playerid) != ngCar1)
        return 
1;
    if(
PlayerInfo[playerid][pMember] == || PlayerInfo[playerid][pLeader] == 3)
        return 
1;
    
SendClientMessage(playeridCOLOR_TRIADS"You are not a member/leader NG!");
    
RemovePlayerFromVehicle(playerid);
    return 
1;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)