how to check whether the vehicle is a player?
#1

I want to block entry to other players when they want to enter as a driver.

Код:
CMD:bmx(playerid, params[])
{
	if(Sklep[playerid][bmx] == 0)
	{
		GraczVeh = 1;
		new string[500];
		new Gname[MAX_PLAYER_NAME];
		GetPlayerName(playerid, Gname, sizeof(Gname));
		format(string, sizeof(string), "/Gracze/%s.ini",Gname);
		Sklep[playerid][bmx] = 1;
		dini_IntSet(string, "bmx", 1);
		SendClientMessage(playerid, C_CYAN, "Motion Of 3Run: {FFFFFF}Kupiles BMX'a");
	}else{
		new Index;
		new tmp2[256]; tmp2 = strtok(params,Index);
		new tmp3[256]; tmp3 = strtok(params,Index);
		if(SpawnedVehicles[playerid] != 0) DestroyVehicle(SpawnedVehicles[playerid]);
		GraczVeh = 1;
		new colour1, colour2;
		if(!strlen(tmp2)) colour1 = random(256); else colour1 = strval(tmp2);
		if(!strlen(tmp3)) colour2 = random(256); else colour2 = strval(tmp3);
		new Float:X,Float:Y,Float:Z;
		new Float:Angle;
		GetPlayerPos(playerid, X,Y,Z);
		GetPlayerFacingAngle(playerid,Angle);
		if(PrivateVehicles[playerid] != 0) DestroyVehicle(PrivateVehicles[playerid]);
		PrivateVehicles[playerid] = CreateVehicle(481, X+0,Y,Z, Angle, colour1, colour2, -1);
		PlayerPlaySound(playerid,1085,0,0,0);
		PutPlayerInVehicle(playerid,PrivateVehicles[playerid],0);
	}
	return 1;
}
Код:
{
	if(// if not this player this vehicle)
	{
		ShowPlayerLangDialog(playerid, 0, DIALOG_STYLE_MSGBOX, "Prywatny Pojazd", "Private Vehicle", "To nie twoj pojazd!\nMozesz kupic wlasny pod komenda /sklep", "This is not your vehicle\nBuy vehicles in /sklep", "Wyjdz", "Exit", "","");
		ClearAnimations(playerid);
		return 1;
	}
	return 1;
}
Reply
#2

IsPlayerInAnyVehicle(playerid)

IsPlayerInVehicle(playerid, vehicleid)
Reply
#3

Want to prevent the player from entering a car/vehicle? Then use OnPlayerEnterVehicle. GetPlayerPos and SetPlayerPos.

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    new Float:pos[4];
    GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
    GetPlayerFacingAngle(playerid, pos[3]);
    SetPlayerPos(playerid, pos[0], pos[1], pos[2]);
    SetPlayerFacingAngle(playerid, pos[3]);
    return 1;
}
..

GetPlayerVehicleID. Returns 0 if player isn't in a vehicle. Returns the vehicle ID That the player is in it.
Reply
#4

iFarbod, no...
I make private vehicles. If this vehicle belongs to the different player entering to vehicle showplayerdialog "this is not your vehicle!" and clearanimations(playerid);

Sorry for my engllish
Reply
#5

Refresh
Reply
#6

Quote:
Originally Posted by iFarbod
Посмотреть сообщение
Want to prevent the player from entering a car/vehicle? Then use OnPlayerEnterVehicle.

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    new Float:pos[4];
    GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
    GetPlayerFacingAngle(playerid, pos[3]);
    SetPlayerPos(playerid, pos[0], pos[1], pos[2]);
    SetPlayerFacingAngle(playerid, pos[3]);
    return 1;
}
..

GetPlayerVehicleID. Returns 0 if player isn't in a vehicle. Returns the vehicle ID That the player is in it.
It can be but it's more easy RemovePlayerFromVehicle
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if(// if vehicle isn't of the player)
    {
        RemovePlayerFromVehicle(playerid);
        ShowPlayerLangDialog(playerid, 0, DIALOG_STYLE_MSGBOX, "Prywatny Pojazd", "Private Vehicle", "To nie twoj pojazd!\nMozesz kupic wlasny pod komenda /sklep", "This is not your vehicle\nBuy vehicles in /sklep", "Wyjdz", "Exit", "","");
        ClearAnimations(playerid);
    }
    return 1;
}
Reply
#7

I dont know this.
*
Код:
 * if(// if vehicle isn't of the player)
how to check
Reply
#8

please help, how to make system private vehicles...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)