SA-MP Forums Archive
[Police] Undercover cars beacon - 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)
+--- Thread: [Police] Undercover cars beacon (/showthread.php?tid=393520)



[Police] Undercover cars beacon [Updated] - Kethrios - 18.11.2012

Hello there,

I've a little problem with a script for sirens:
http://forum.sa-mp.com/showthread.ph...ighlight=siren


The thing is that, when I compile I get the following warning :
Код:
warning 203: symbol is never used: "siren"
So... I can't use the /siren command ingame.

I tried to fix it with this at the top of the code for the plugin :
if(strcmp(cmd, "/siren", true) == 0)

But I get this error :
Код:
error 010: invalid function or declaration



Re : [Police] Undercover cars beacon - Kethrios - 18.11.2012

Updated.


Re: [Police] Undercover cars beacon - Mr.Anonymous - 18.11.2012

Quote:
Originally Posted by Brandon Javorsky
Посмотреть сообщение
Make sure this was added in:


pawn Код:
new Siren[MAX_VEHICLES];
new SirenObject[MAX_VEHICLES];
This.


Re : [Police] Undercover cars beacon - Kethrios - 18.11.2012

I already added this.
That's why I'm posting, I don't know what the problem is.


Re : [Police] Undercover cars beacon - Kethrios - 18.11.2012

I forgot to add #define zcmd and #define sscanf2
Now I get there errors :

Код:
C:\Users\Geo\Desktop\Ca marche\a jour\gamemodes\usrp.pwn(464) : error 017: undefined symbol "COLOR_WHITE"
C:\Users\Geo\Desktop\Ca marche\a jour\gamemodes\usrp.pwn(465) : error 017: undefined symbol "COLOR_GRAD2"
C:\Users\Geo\Desktop\Ca marche\a jour\gamemodes\usrp.pwn(474) : error 017: undefined symbol "COLOR_GRAD2"
C:\Users\Geo\Desktop\Ca marche\a jour\gamemodes\usrp.pwn(477) : warning 217: loose indentation
C:\Users\Geo\Desktop\Ca marche\a jour\gamemodes\usrp.pwn(483) : error 017: undefined symbol "COLOR_PURPLE"
C:\Users\Geo\Desktop\Ca marche\a jour\gamemodes\usrp.pwn(484) : warning 217: loose indentation
C:\Users\Geo\Desktop\Ca marche\a jour\gamemodes\usrp.pwn(490) : error 017: undefined symbol "COLOR_GRAD2"
C:\Users\Geo\Desktop\Ca marche\a jour\gamemodes\usrp.pwn(493) : warning 217: loose indentation
C:\Users\Geo\Desktop\Ca marche\a jour\gamemodes\usrp.pwn(499) : error 017: undefined symbol "COLOR_PURPLE"
C:\Users\Geo\Desktop\Ca marche\a jour\gamemodes\usrp.pwn(506) : error 017: undefined symbol "COLOR_GRAD2"
C:\Users\Geo\Desktop\Ca marche\a jour\gamemodes\usrp.pwn(514) : error 017: undefined symbol "COLOR_PURPLE"
C:\Users\Geo\Desktop\Ca marche\a jour\gamemodes\usrp.pwn(519) : error 017: undefined symbol "COLOR_WHITE"
C:\Users\Geo\Desktop\Ca marche\a jour\gamemodes\usrp.pwn(520) : error 017: undefined symbol "COLOR_GRAD2"
C:\Users\Geo\Desktop\Ca marche\a jour\gamemodes\usrp.pwn(524) : error 017: undefined symbol "COLOR_GREY"

There is my code :


Код:
CMD:siren(playerid, params[])
{
    if(IsACop(playerid))
    {
        new string[128], type;
        new VID = GetPlayerVehicleID(playerid);
        if(sscanf(params, "d", type))
        {
            SendClientMessage(playerid, COLOR_WHITE, "USAGE: /siren [type]");
            SendClientMessage(playerid, COLOR_GRAD2, "Type: 1 = Inside, 2 = Roof, 3 = Off.");
            return 1;
        }
        switch(type)
        {
        case 1:
            {
                if(Siren[VID] == 1)
                {
                    SendClientMessage(playerid, COLOR_GRAD2, "This vehicle already has a siren!");
                    return 1;
                }
                 new sendername[MAX_PLAYER_NAME];
                 Siren[VID] = 1;
                 GetPlayerName(playerid, sendername, sizeof(sendername));
                 SirenObject[VID] = CreateObject(18646, 10.0, 10.0, 10.0, 0, 0, 0);
                 AttachObjectToVehicle(SirenObject[VID], VID, 0.0, 0.75, 0.275, 0.0, 0.1, 0.0);
                 format(string, sizeof(string), "* %s puts the siren on the dashboard.", sendername);
                 ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                return 1;
            }
        case 2:
            {
                if(Siren[VID] == 1)
                {
                    SendClientMessage(playerid, COLOR_GRAD2, "This vehicle already has a siren!");
                    return 1;
                }
                        Siren[VID] = 1;
                        new sendername[MAX_PLAYER_NAME];
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                        SirenObject[VID] = CreateObject(18646, 10.0, 10.0, 10.0, 0, 0, 0);
                        AttachObjectToVehicle(SirenObject[VID], VID, -0.43, 0.0, 0.785, 0.0, 0.1, 0.0);
                        format(string, sizeof(string), "* %s puts the siren on the roof.", sendername);
                        ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                        return 1;
            }
        case 3:
            {
                if(Siren[VID] == 0)
                {
                    SendClientMessage(playerid, COLOR_GRAD2, "This vehicle doesn't have a siren on it!");
                    return 1;
                }
                Siren[VID] = 0;
                new sendername[MAX_PLAYER_NAME];
                GetPlayerName(playerid, sendername, sizeof(sendername));
                DestroyObject(SirenObject[VID]);
                format(string, sizeof(string), "* %s takes down the siren.", sendername);
                ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                return 1;
            }
        default:
            {
                SendClientMessage(playerid, COLOR_WHITE, "Invalid license type! /siren [type]");
                SendClientMessage(playerid, COLOR_GRAD2, "Type: 1 = Roof, 2 = Inside, 3 = Off.");
            }
        }
    }
    else SendClientMessage(playerid, COLOR_GREY, "You're not authorised to use this command.");
    return 1;
}
thanks in advance.


Re: [Police] Undercover cars beacon - jakejohnsonusa - 18.11.2012

They are all defining color errors. So just define the colors at the beggining of your GM or FS.

Example:
pawn Код:
#define COLOR_PURPLE 0xC2A2DAAA



Re: [Police] Undercover cars beacon - jakejohnsonusa - 18.11.2012

Please put your code in pawn /pawno Brackets instead of Code Brackets (to make the codes indentation appear, so We acn help you fix the indentation warnings.


Re : [Police] Undercover cars beacon - Kethrios - 18.11.2012

Hey,

First of all I would like to thank you for your help.


Now the errors are gone, but I still have the following warnings :
Код:
C:\Users\Geo\Desktop\Ca marche\a jour\gamemodes\usrp.pwn(482) : warning 225: unreachable code
C:\Users\Geo\Desktop\Ca marche\a jour\gamemodes\usrp.pwn(494) : warning 217: loose indentation
C:\Users\Geo\Desktop\Ca marche\a jour\gamemodes\usrp.pwn(500) : warning 202: number of arguments does not match definition
C:\Users\Geo\Desktop\Ca marche\a jour\gamemodes\usrp.pwn(501) : warning 217: loose indentation
C:\Users\Geo\Desktop\Ca marche\a jour\gamemodes\usrp.pwn(510) : warning 217: loose indentation
C:\Users\Geo\Desktop\Ca marche\a jour\gamemodes\usrp.pwn(516) : warning 202: number of arguments does not match definition
C:\Users\Geo\Desktop\Ca marche\a jour\gamemodes\usrp.pwn(531) : warning 202: number of arguments does not match definition
C:\Users\Geo\Desktop\Ca marche\a jour\gamemodes\usrp.pwn(537) : warning 225: unreachable code
Here is the code with the brackets you asked for :


pawn Код:
LINE 473         CMD:siren(playerid, params[])
{
    if(IsACop(playerid))
    {
        new string[128], type;
        new VID = GetPlayerVehicleID(playerid);
        if(sscanf(params, "d", type))
        {
            return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /siren [type]");
            return SendClientMessage(playerid, COLOR_GRAD2, "Type: 1 = Inside, 2 = Roof, 3 = Off.");
           
        }
        switch(type)
        {
        case 1:
            {
                if(Siren[VID] == 1)
                {
                    return SendClientMessage(playerid, COLOR_GRAD2, "This vehicle already has a siren!");

                }
                 new sendername[MAX_PLAYER_NAME];
                 Siren[VID] = 1;
                 GetPlayerName(playerid, sendername, sizeof(sendername));
                 SirenObject[VID] = CreateObject(18646, 10.0, 10.0, 10.0, 0, 0, 0);
                 AttachObjectToVehicle(SirenObject[VID], VID, 0.0, 0.75, 0.275, 0.0, 0.1, 0.0);
                 format(string, sizeof(string), "* %s puts the siren on the dashboard.", sendername);
LINE 500              ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                return 1;
            }
        case 2:
            {
                if(Siren[VID] == 1)
                {
                    return SendClientMessage(playerid, COLOR_GRAD2, "This vehicle already has a siren!");

                }
                        Siren[VID] = 1;
                        new sendername[MAX_PLAYER_NAME];
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                        SirenObject[VID] = CreateObject(18646, 10.0, 10.0, 10.0, 0, 0, 0);
                        AttachObjectToVehicle(SirenObject[VID], VID, -0.43, 0.0, 0.785, 0.0, 0.1, 0.0);
                        format(string, sizeof(string), "* %s puts the siren on the roof.", sendername);
LINE 516                      ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                        return 1;
            }
        case 3:
            {
                if(Siren[VID] == 0)
                {
                    return SendClientMessage(playerid, COLOR_GRAD2, "This vehicle doesn't have a siren on it!");

                }
                Siren[VID] = 0;
                new sendername[MAX_PLAYER_NAME];
                GetPlayerName(playerid, sendername, sizeof(sendername));
                DestroyObject(SirenObject[VID]);
                format(string, sizeof(string), "* %s takes down the siren.", sendername);
LINE 531              ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                return 1;
            }
        default:
            {
                return SendClientMessage(playerid, COLOR_WHITE, "Invalid license type! /siren [type]");
                return SendClientMessage(playerid, COLOR_GRAD2, "Type: 1 = Roof, 2 = Inside, 3 = Off.");
            }
        }
    }
    else return SendClientMessage(playerid, COLOR_GREY, "You're not authorised to use this command.");
    return 1;
LINE 544      }



Re: [Police] Undercover cars beacon - jakejohnsonusa - 18.11.2012

Can you include the line #'s please (at least for the first one and last one).

And no problem


Re : [Police] Undercover cars beacon - Kethrios - 18.11.2012

I edited my previous post with the line numbers.
Thank you again ^^