I can not get in the car
#1

I want to add some cars to a certain faction and when I walk into play pushes me out of the car automatically.
I do not know how to make them.
PHP код:
        new idcar GetPlayerVehicleID(playerid);
        if(
IsGovermentCar(idcar))
        {
              if(
GetPVarInt(playerid"Member") == 3)
              {
                
SendClientMessage(playeridCOLOR_WHITE"Test");
                
PutPlayerInVehicle(playerididcar,0);
              }
            else
            {
                
SendClientMessage(playeridCOLOR_WHITE"Nu esti membru al guvernului !");
            }
        } 
Reply
#2

Use RemovePlayerFromVehicle
example :
Код:
new idcar = GetPlayerVehicleID(playerid); 
        if(IsGovermentCar(idcar)) 
        { 
              if(GetPVarInt(playerid, "Member") == 3) 
              { 
                SendClientMessage(playerid, COLOR_WHITE, "Test"); 
                PutPlayerInVehicle(playerid, idcar,0); 
              } 
            else 
            { 
                SendClientMessage(playerid, COLOR_WHITE, "Nu esti membru al guvernului !"); 
                RemovePlayerFromVehicle(playerid);
            } 
        }
Reply
#3

don't work..
Reply
#4

If this is OnPlayerEnterVehicle, you can use this code:

Код:
ClearAnimations(playerid,1);
To clear the animation of entering the vehicle, this, essentially, stops a player from entering a vehicle if you don't want them too, heres an example of it from my house and car script I'm coding:

Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
	new pName[24];
	GetPlayerName(playerid,pName,24);
	if(vData[vehicleid][vPublic] == 0 && strcmp(vData[vehicleid][vOwner],pName) == 0 && ispassenger == 0 && vData[vehicleid][vLocked] == 1) {
		ClearAnimations(playerid,1);
		SendClientMessage(playerid,-1,"This isn't your car!");
		return 0;
	}
	return 1;
}
It also has other uses, as it clears every animation in progress when called, I believe that is what you want though.
Reply
#5

don't work.. )
Reply
#6

Use OnPlayerStateChange and RemovePlayerFromVehicle.

Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
	if (newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
	{
		new idcar = GetPlayerVehicleID(playerid); 
	    if(IsGovermentCar(idcar)) 
	    { 
	      	if(GetPVarInt(playerid, "Member") == 3) 
	     	{ 
	     		SendClientMessage(playerid, COLOR_WHITE, "Test"); 
	   		} 
	        else 
	        { 
	            SendClientMessage(playerid, COLOR_WHITE, "Nu esti membru al guvernului !"); 
	            RemovePlayerFromVehicle(playerid);
	        } 
	    }
	}
return 1;
}
Reply
#7

still don't working..
Reply
#8

Quote:
Originally Posted by radiobizza
Посмотреть сообщение
still don't working..
Then..post the function IsGovermentCar, how you create the vehicles and what your current Code looks like
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)