Check if Player is in one of 4 Vehicle ids
#1

I have an Problem, yea i know, i have lots of problems with scripting XD
I have an siren command, where an object spawns and it attaches to the vehicle and all, but my problem is, i want that it works on 4-5 different ids, and if the player is in non of these ids then an error would display. And if he is in one of these ids, example: if im in id 560 then the object spawns, and in 426 the same, and if he's not in one of those then error.


My whole command:

Код:
CMD:bl(playerid, params[])
{
	new vID = GetPlayerVehicleID(playerid);
    if(eingeloggt[playerid] == 0)return SendClientMessage(playerid,COLOR_RED,"Du bist noch nicht eingeloggt.");
    if(pTazed[playerid] == 1)return SendClientMessage(playerid,COLOR_RED,"Du bist getazed.");
    if(pInfo[playerid][fraktion] != 1)return SendClientMessage(playerid,COLOR_RED,"Du bist kein Mitglied vom SFPD.");
    if(pInfo[playerid][fraktion] == 1 && pInfo[playerid][duty] != 1)return SendClientMessage(playerid,COLOR_RED,"Du bist nicht im Dienst.");
    if(GetPVarInt(playerid,"SireneAn") == 1)
    {
    	DestroyObject(blaulicht[playerid]);
    	DestroyObject(blaulicht2[playerid]);
    	DestroyObject(blaulicht3[playerid]);
     	GameTextForPlayer(playerid,"~r~Blaulicht Deaktiviert",2000,3);
   		SetPVarInt(playerid,"SireneAn",0);
     	return 1;
	}
    if(!IsPlayerInAnyVehicle(playerid))return SendClientMessage(playerid,COLOR_RED,"Du sitzt in keinem Fahrzeug.");
    if(!IsAPoliceVehicle(vID))return SendClientMessage(playerid,COLOR_RED,"Du sitzt in keinem PD Fahrzeug.");
    if(GetVehicleModel(vID) != 426 | 560)return SendClientMessage(playerid,COLOR_RED,"Du sitzt in keinem PD Premier/Sultan/Cheetah/Securicar");
    if(GetVehicleModel(vID) == 426)
    {
        if(GetPVarInt(playerid,"SireneAn") == 1)
        {
            DestroyObject(blaulicht[playerid]);
	    	DestroyObject(blaulicht2[playerid]);
	    	DestroyObject(blaulicht3[playerid]);
            GameTextForPlayer(playerid,"~r~Blaulicht Deaktiviert",2000,3);
            SetPVarInt(playerid,"SireneAn",0);
            return 1;
        }
        DestroyObject(blaulicht[playerid]);
		new Float:x,Float:y,Float:z;
		GetPlayerPos(playerid,x,y,z);
        blaulicht[playerid] = CreateObject(19797,0.0,0.0,0.0,0.0,0.0,0.0);
        blaulicht2[playerid] = CreateObject(19797,0.0,0.0,0.0,0.0,0.0,0.0);
        blaulicht3[playerid] = CreateObject(19797,0.0,0.0,0.0,0.0,0.0,0.0);
        AttachObjectToVehicle(blaulicht[playerid],vID,0.0,0.35,0.65,0.0,0.0,180.0);
        AttachObjectToVehicle(blaulicht2[playerid],vID,0.5,-1.35,0.40,0.0,0.0,0.0);
        AttachObjectToVehicle(blaulicht3[playerid],vID,-0.5,-1.35,0.40,0.0,180.0,0.0);
        GameTextForPlayer(playerid,"~g~Blaulicht Aktiviert",2000,3);
        SetPVarInt(playerid,"SireneAn",1);
        return 1;
    }
    if(GetVehicleModel(vID) == 560)
    {
        if(GetPVarInt(playerid,"SireneAn") == 1)
        {
            DestroyObject(blaulicht[playerid]);
	    	DestroyObject(blaulicht2[playerid]);
	    	DestroyObject(blaulicht3[playerid]);
            GameTextForPlayer(playerid,"~r~Blaulicht Deaktiviert",2000,3);
            SetPVarInt(playerid,"SireneAn",0);
            return 1;
        }
        DestroyObject(blaulicht[playerid]);
		new Float:x,Float:y,Float:z;
		GetPlayerPos(playerid,x,y,z);
        blaulicht[playerid] = CreateObject(19797,0.0,0.0,0.0,0.0,0.0,0.0);
        blaulicht2[playerid] = CreateObject(19797,0.0,0.0,0.0,0.0,0.0,0.0);
        blaulicht3[playerid] = CreateObject(19797,0.0,0.0,0.0,0.0,0.0,0.0);
        AttachObjectToVehicle(blaulicht[playerid],vID,0.0,0.35,0.65,0.0,0.0,180.0);
        AttachObjectToVehicle(blaulicht2[playerid],vID,0.5,-1.35,0.40,0.0,0.0,0.0);
        AttachObjectToVehicle(blaulicht3[playerid],vID,-0.5,-1.35,0.40,0.0,180.0,0.0);
        GameTextForPlayer(playerid,"~g~Blaulicht Aktiviert",2000,3);
        SetPVarInt(playerid,"SireneAn",1);
    }
	return 1;
}
my Error:

Код:
if(GetVehicleModel(vID) != 426 | 560)return SendClientMessage(playerid,COLOR_RED,"Du sitzt in keinem PD Premier/Sultan/Cheetah/Securicar");
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)