[Police] Undercover cars beacon
#1

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
Reply
#2

Updated.
Reply
#3

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


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

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

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.
Reply
#6

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
Reply
#7

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.
Reply
#8

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      }
Reply
#9

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

And no problem
Reply
#10

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


Forum Jump:


Users browsing this thread: 1 Guest(s)