SA-MP Forums Archive
Help with neon lights - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help with neon lights (/showthread.php?tid=195830)



Help with neon lights - scripter1 - 03.12.2010

Alright. I have this command that is suppose to add neon lights under your vehicle. It's suppose to detect what model your vehicle is and based on that, it should put the neon lights underneath the vehicle. Now the command it looks like it works, but nothing happens in-game. Can somebody help me out here?

pawn Код:
if(strcmp(cmd, "/neon", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(PlayerInfo[playerid][pAdmin] > 0)
            {
                new id;
                id = GetVehicleModel(playerid);
                new neon;
                if(id == 400)
                {
                    neon = CreateObject(18648,0,0,0,0,0,0,283);
                    AttachObjectToVehicle(neon, id, 0.2,0,0.71,0,0,0);
                }
                if(id == 401)
                {
                    neon = CreateObject(18648,0,5,25,0,0,0,283);
                    AttachObjectToVehicle(neon, id, 0.2,0,0.71,0,0,0);
                }
            }
            return 1;
        }
    }



Re: Help with neon lights - Zamaroht - 03.12.2010

You have to use the vehicle id to attach the object to, not the model id. That is, try this code:

pawn Код:
if(strcmp(cmd, "/neon", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(PlayerInfo[playerid][pAdmin] > 0)
            {
                new id;
                id = GetVehicleModel(playerid);
                new neon;
                new vehid = GetPlayerVehicleID(playerid);
                if(id == 400)
                {
                    neon = CreateObject(18648,0,0,0,0,0,0,283);
                    AttachObjectToVehicle(neon, vehid, 0.2,0,0.71,0,0,0);
                }
                if(id == 401)
                {
                    neon = CreateObject(18648,0,5,25,0,0,0,283);
                    AttachObjectToVehicle(neon, vehid, 0.2,0,0.71,0,0,0);
                }
            }
            return 1;
        }
    }



Re: Help with neon lights - piohh - 03.12.2010

Quote:
Originally Posted by scripter1
Посмотреть сообщение
Alright. I have this command that is suppose to add neon lights under your vehicle. It's suppose to detect what model your vehicle is and based on that, it should put the neon lights underneath the vehicle. Now the command it looks like it works, but nothing happens in-game. Can somebody help me out here?

pawn Код:
if(strcmp(cmd, "/neon", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(PlayerInfo[playerid][pAdmin] > 0)
            {
                new id;
                id = GetVehicleModel(playerid);
                new neon;
                if(id == 400)
                {
                    neon = CreateObject(18648,0,0,0,0,0,0,283);
                    AttachObjectToVehicle(neon, id, 0.2,0,0.71,0,0,0);
                }
                if(id == 401)
                {
                    neon = CreateObject(18648,0,5,25,0,0,0,283);
                    AttachObjectToVehicle(neon, id, 0.2,0,0.71,0,0,0);
                }
            }
            return 1;
        }
    }
why the return 1 is under the pAdmin. I think it must under isplayerconnect...
and use else if for Car ID 401


Re: Help with neon lights - Axuj - 03.12.2010

pawn Код:
if(strcmp(cmd, "/neon", true) == 0)
{
    if(IsPlayerConnected(playerid))
    {
        if(PlayerInfo[playerid][pAdmin] > 0)
        {
            if( !IsPlayerInAnyVehicle( playerid ) return;
           
            new
                id,
                neon,
                vehid;
               
            id = GetVehicleModel(playerid);
            vehid = GetPlayerVehicleID(playerid);
               
            if(id == 400)
            {
                neon = CreateObject(18648,0,0,0,0,0,0,283);
                AttachObjectToVehicle(neon, vehid, 0.2,0,0.71,0,0,0);
            }
            if(id == 401)
            {
                neon = CreateObject(18648,0,5,25,0,0,0,283);
                AttachObjectToVehicle(neon, vehid, 0.2,0,0.71,0,0,0);
            }
        }
        return 1;
    }
}
This checks, is player in vehicle or not.


Re: Help with neon lights - The_Gangstas - 03.12.2010

this is what he wants.

pawn Код:
if(strcmp(cmd, "/neon", true) == 0)
{
    if(IsPlayerConnected(playerid))
    {
        if(PlayerInfo[playerid][pAdmin] > 0)
        {
            if( !IsPlayerInAnyVehicle( playerid ) return;

            new
                id,
                neon,
                vehid;

            id = GetVehicleModel(GetPlayerVehicleID(playerid));
            vehid = GetPlayerVehicleID(playerid);
            if(id == 400)
            {
                neon = CreateObject(18648,0,0,0,0,0,0,283);
                AttachObjectToVehicle(neon, vehid, 0.2,0,0.71,0,0,0);
            }
            if(id == 401)
            {
                neon = CreateObject(18648,0,5,25,0,0,0,283);
                AttachObjectToVehicle(neon, vehid, 0.2,0,0.71,0,0,0);
            }
        }
        return 1;
    }
}



AW: Help with neon lights - KingCaN - 03.12.2010

ok what's in this command?
so where should I put it?


Re: Help with neon lights - scripter1 - 03.12.2010

It still won't work. I see nothing, and yes I am doing this at night time.


Re: AW: Help with neon lights - scripter1 - 03.12.2010

Quote:
Originally Posted by KingCaN
Посмотреть сообщение
ok what's in this command?
so where should I put it?
Like I stated before, this command detects what model vehicle your in, and based on that it sets the neon lights underneath the vehicle. It goes under OnPlayerCommandText.


AW: Help with neon lights - KingCaN - 03.12.2010

what do you mean?!


Re: Help with neon lights - StreetGT - 03.12.2010

Quote:
Originally Posted by piohh
Посмотреть сообщение
why the return 1 is under the pAdmin. I think it must under isplayerconnect...
and use else if for Car ID 401
sure

"The message you have entered is too short. Please lengthen your message to at least 8 characters."