noob vehicles (like Police cars...)
#1

i want to make it work in this way:

pawn Код:
if(DOF2_GetInt(pFile(playerid),"Level")>3)
if player trying to get in this vehicles as a driver:
pawn Код:
NoobVehicle[1] || NoobVehicle[2] || NoobVehicle[3]
(until NoobVehicle[18], if you didn't understood "||" means or)

its will do this:
pawn Код:
GetPlayerPos(playerid,fX,fY,fZ);
SetPlayerPos(playerid,fX,fY,fZ+1);
I want it will work with the public OnPlayerChangeKeyState please
Reply
#2

Work how? I can't determine what you're trying to do.
Reply
#3

As far as I know checking a player's state doesn't work under OnPlayerKeyStateChange but under OnPlayerStateChange
You have to check if the player enters a vehicle AS a driver.

You have to check that under the callback OnPlayerStateChange.
pawn Код:
newstate == PLAYER_STATE_DRIVER
Then check if the player is a driver in one of the "NoobVehicles". If that's the case, raise his position on the Z-axis.
Reply
#4

Well, I can't make it do it exactly how you want it. But, why not try a RemovePlayerFromVehicle(playerid);

So like,

Код:
		if(newcar == NoobVehicle[1]) {
		    if(playerInfo[playerid][pLevel] < 3)
		        RemovePlayerFromVehicle(playerid);
				SendClientMessage(playerid, COLOR_LIGHTRED, " You do not have the keys!");
			}
			return 1;
		}
And just keep adding to those, that's the easiest way you can do this.
Reply
#5

Quote:
Originally Posted by Bible
Посмотреть сообщение
As far as I know checking a player's state doesn't work under OnPlayerKeyStateChange but under OnPlayerStateChange
You have to check if the player enters a vehicle AS a driver.

You have to check that under the callback OnPlayerStateChange.
pawn Код:
newstate == PLAYER_STATE_DRIVER
Then check if the player is a driver in one of the "NoobVehicles". If that's the case, raise his position on the Z-axis.
ok so how can i do it? can you give me example please? (im asking u cuz i answered the best answer)
Reply
#6

Something like this: (This is just a quick example on how it should look like, this hasn't been tested)

pawn Код:
if(IsPlayerInVehicle(playerid, NoobVehicle[1]) || IsPlayerInVehicle(playerid, NoobVehicle[2]) || IsPlayerInVehicle(playerid, NoobVehicle[3]))
    {
        if(newstate == PLAYER_STATE_DRIVER)
        {  
            if(PlayerInfo[playerid][pLevel] > 3) //This means: If the player is above level 3 it will execute the code between the brackets.
            {
                new Float:fX, Float:fY, Float:fZ; //Remove this if you already have these variables.
                GetPlayerPos(playerid,fX,fY,fZ);
                SetPlayerPos(playerid,fX,fY,fZ+1);
            }
        }
    }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)