Problems with OnPlayerStateChange Drivingschool
#1

Hey guys, i was trying to make a drinving school for my german roleplay script,
So first i got something that checks if the car is bike so you don't get the message how to turn the engine on (WithoutMotor) then i got some Driving car for the Drivingschool (Fahrschulauto) and i got something that turns to 1 so he can drive the drivingschool car (pInfo[playerid][pFahrstunde]) but when i get on a Bike ( so a car without an engine) it tells me i don't startet the drivingtest


Код:
	if(newstate == PLAYER_STATE_DRIVER)
 	{
		for(new p; p < sizeof(Fahrschulauto); p++)
		{
		    new vehid=GetPlayerVehicleID(playerid);
			if(vehid == p)
			{
				if(pInfo[playerid][pFahrstunde] != 1)
				{
					SendClientMessage(playerid, -1,"{c45461}Du musst zuerst die Fahrstunde starten um mit der Prьfung anzufangen.");
					return RemovePlayerFromVehicle(playerid);
				}
			}
		}
	}
	
    new vehicleid=GetPlayerVehicleID(playerid);
	if(WithoutMotor(vehicleid))
	{
	    if(newstate == PLAYER_STATE_DRIVER)
	    if(pInfo[playerid][pAutoschein]== 0)
	    {
  			SendClientMessage(playerid, -1,"{c45461}Du hast noch keinen Autoschein.");
			return RemovePlayerFromVehicle(playerid);
		}
		else
		{
	    	SendClientMessage(playerid,-1,"{FAFAFA}Benutze den Befehl{009BFF} /Motor{FAFAFA} um den Motor zu starten. Mit den Befehl {009BFF}/Licht{FAFAFA} schaltest du das Licht ein.");
		}
	}
Reply
#2

Translate your code to english please?
Reply
#3

Код:
	if(newstate == PLAYER_STATE_DRIVER)
 	{
		for(new p; p < sizeof(DrivingCars); p++)
		{
		    new vehid=GetPlayerVehicleID(playerid);
			if(vehid == p)
			{
				if(pInfo[playerid][ptempdrivinglicence] != 1)
				{
					SendClientMessage(playerid, -1,"{c45461}first you need to start the driving test, you can start it in the driving school.");
					return RemovePlayerFromVehicle(playerid);
				}
			}
		}
	}
	
    new vehicleid=GetPlayerVehicleID(playerid);
	if(WithoutMotor(vehicleid))
	{
	    if(newstate == PLAYER_STATE_DRIVER)
	    if(pInfo[playerid][pDrivingLicence]== 0)
	    {
  			SendClientMessage(playerid, -1,"{c45461}You don't have a driving licence.");
			return RemovePlayerFromVehicle(playerid);
		}
		else
		{
	    	SendClientMessage(playerid,-1,"{use /engine to turn on the engine ");
		}
	}
Reply
#4

Change these codes
Код:
if(newstate == PLAYER_STATE_DRIVER)
 	{
		for(new p; p < sizeof(DrivingCars); p++)
		{
		    new vehid=GetPlayerVehicleID(playerid);
			if(vehid == p)
			{
				if(pInfo[playerid][ptempdrivinglicence] != 1)
				{
					SendClientMessage(playerid, -1,"{c45461}first you need to start the driving test, you can start it in the driving school.");
					return RemovePlayerFromVehicle(playerid);
				}
			}
		}
	}
into
Код:
if(newstate == PLAYER_STATE_DRIVER) 
{
    // get vehicle id
    new vehid = GetPlayerVehicleID(playerid);
    // check if vehicle doesn't have engine
    if(WithoutMotor(vehid))
    {
        for(new p; p < sizeof(DrivingCars); p++)
        {
            if(vehid == p)
            {
                if(pInfo[playerid][ptempdrivinglicence] != 1)
                {
                    SendClientMessage(playerid, -1,"{c45461}first you need to start the driving test, you can start it in the driving school.");
                    return RemovePlayerFromVehicle(playerid);
                }
                // break the loop
                break;
            }
        }
    }
}
i added check on the code, so it won't send you a driving test message if you're not in a motor vehicles.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)