#1

pawn Код:
if(strcmp(cmd, "/siren", true, 10) == 0)
    {
            if(IsPlayerInAnyVehicle(playerid))
        {
        new vehicleid = GetPlayerVehicleID(playerid);
        if(Lamp[vehicleid] == 1) return OnPlayerCommandText(playerid, "/sirenoff");
        if(IsPlayerConnected(playerid))
        {
            new Float:x, Float:y, Float:z, Float:angle;
            if(IsPlayerInVehicle(playerid, 579))
            {
                GetPlayerPos(playerid, x, y, z);
                GetPlayerFacingAngle(playerid, angle);
                IsSpu[vehicleid] = 1;
                Lamp[vehicleid] = 1;
                light[vehicleid] = CreateObject(19419, 10.0, 10.0, 10.0, 0.0, 0.0, 0.0);
                AttachObjectToVehicle(light[vehicleid], GetPlayerVehicleID(playerid), 0.000000, 0.074999, 1.214999, 0.000000, 0.000000, 0.000000);
            }
            else if(IsPlayerInVehicle(playerid, 426))
            {
                GetPlayerPos(playerid, x, y, z);
                GetPlayerFacingAngle(playerid, angle);
                IsSpu[vehicleid] = 1;
                Lamp[vehicleid] = 1;
                light[vehicleid] = CreateObject(19419, 10.0, 10.0, 10.0, 0.0, 0.0, 0.0);
                AttachObjectToVehicle(light[vehicleid], GetPlayerVehicleID(playerid), 0.000000, -1.664998, 0.329999, 0.000000, 0.000000, 0.000000);
            }
            else if(IsPlayerInVehicle(playerid, 402))
            {
                GetPlayerPos(playerid, x, y, z);
                GetPlayerFacingAngle(playerid, angle);
                IsSpu[vehicleid] = 1;
                Lamp[vehicleid] = 1;
                light[vehicleid] = CreateObject(19419, 10.0, 10.0, 10.0, 0.0, 0.0, 0.0);
                AttachObjectToVehicle(light[vehicleid], vehicleid, -0.599999, -0.329999, 0.829999, 0.000000, 0.000000, 0.000000);
            }
            else if(IsPlayerInVehicle(playerid, 482))
            {
                GetPlayerPos(playerid, x, y, z);
                GetPlayerFacingAngle(playerid, angle);
                IsSpu[vehicleid] = 1;
                Lamp[vehicleid] = 1;
                light[vehicleid] = CreateObject(18646, 10.0, 10.0, 10.0, 0.0, 0.0, 0.0);
                AttachObjectToVehicle(light[vehicleid], vehicleid, -0.489999, 0.734999, 0.969999, 0.000000, 0.000000, 0.000000);
            }
            else if(IsPlayerInVehicle(playerid, 523))
            {
                GetPlayerPos(playerid, x, y, z);
                GetPlayerFacingAngle(playerid, angle);
                IsSpu[vehicleid] = 1;
                Lamp[vehicleid] = 1;
                light[vehicleid] = CreateObject(18646, 10.0, 10.0, 10.0, 0.0, 0.0, 0.0);
                AttachObjectToVehicle(light[vehicleid], vehicleid, 0.000000, -0.959999, 0.689999, 0.000000, 0.000000, 0.000000);
            }
            else if(IsPlayerInVehicle(playerid, 528))
            {
                GetPlayerPos(playerid, x, y, z);
                GetPlayerFacingAngle(playerid, angle);
                IsSpu[vehicleid] = 1;
                Lamp[vehicleid] = 1;
                light[vehicleid] = CreateObject(19419, 10.0, 10.0, 10.0, 0.0, 0.0, 0.0);
                AttachObjectToVehicle(light[vehicleid], vehicleid, 0.000000, 0.314999, 1.059999, 0.000000, 0.000000, 0.000000);
            }
            else if(IsPlayerInVehicle(playerid, 421))
            {
                GetPlayerPos(playerid, x, y, z);
                GetPlayerFacingAngle(playerid, angle);
                IsSpu[vehicleid] = 1;
                Lamp[vehicleid] = 1;
                light[vehicleid] = CreateObject(18646, 10.0, 10.0, 10.0, 0.0, 0.0, 0.0);
                AttachObjectToVehicle(light[vehicleid], vehicleid, -0.379999, 0.159999, 0.759999, 0.000000, 0.000000, 0.000000);
            }
            else if(IsPlayerInVehicle(playerid, 415))
            {
                GetPlayerPos(playerid, x, y, z);
                GetPlayerFacingAngle(playerid, angle);
                IsSpu[vehicleid] = 1;
                Lamp[vehicleid] = 1;
                light[vehicleid] = CreateObject(18646, 10.0, 10.0, 10.0, 0.0, 0.0, 0.0);
                AttachObjectToVehicle(light[vehicleid], vehicleid, -0.379999, -0.414999, 0.664999, 0.000000, 0.000000, 0.000000);
                print("WORKS!");
            }
            else if(IsPlayerInVehicle(playerid, 541))
            {
                GetPlayerPos(playerid, x, y, z);
                GetPlayerFacingAngle(playerid, angle);
                IsSpu[vehicleid] = 1;
                Lamp[vehicleid] = 1;
                light[vehicleid] = CreateObject(18646, 10.0, 10.0, 10.0, 0.0, 0.0, 0.0);
                AttachObjectToVehicle(light[vehicleid], vehicleid, -0.454999, 0.064999, 0.694999, 0.000000, 0.000000, 0.000000);
            }
        return 1;
        }
        }
        return 1;
    }
what's wrong with this code? It doesn't create a siren.
Reply
#2

You're using model ID when you have to use vehicle ID.
Reply
#3

I was tried with GetVehicleModelID
Reply
#4

Yet again with that function you need the vehicle ID.

Here's how you can do it:

pawn Код:
new
    iVehicle = GetVehicleModelID( GetPlayerVehicleID( playerid ))
;
if( iVehicle == 426 )
Reply
#5

Thank you!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)