/siren script won't work.
#1

This is the script:
Код:
Код:
new Siren[MAX_VEHICLES];
new SirenObject[MAX_VEHICLES];






CMD:siren(playerid, params[])
{
	if(IsACop(playerid))
	{
		new string[128], type;
		new VID = GetPlayerVehicleID(playerid);
		if(sscanf(params, "d", type))
		{
			SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /siren [type]");
			SendClientMessageEx(playerid, COLOR_GRAD2, "Type: 1 = Inside, 2 = Roof, 3 = Off.");
			return 1;
		}
		switch(type)
		{
		case 1:
			{
				if(Siren[VID] == 1)
				{
					SendClientMessageEx(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)
				{
					SendClientMessageEx(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)
				{
					SendClientMessageEx(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:
			{
				SendClientMessageEx(playerid, COLOR_WHITE, "Invalid license type! /siren [type]");
				SendClientMessageEx(playerid, COLOR_GRAD2, "Type: 1 = Roof, 2 = Inside, 3 = Off.");
			}
		}
	}
	else SendClientMessageEx(playerid, COLOR_GREY, "You're not authorised to use this command.");
	return 1;
}
This is the error:
Код:
C:\Program Files\GTA\server\gamemodes\dnrp1.pwn(83184) : warning 203: symbol is never used: "siren"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Warning.
What do i need to do with this? i want to use this but my compiler keep saying this error, how can i make it work?
Reply
#2

You simply defined the variable "siren" but never used it in the script.
Reply
#3

Delete that line:

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

then i get this:

Quote:

C:\Program Files\GTA\server\gamemodes\dnrp1.pwn(83183) : error 021: symbol already defined: "SirenObject"
C:\Program Files\GTA\server\gamemodes\dnrp1.pwn(83186) : error 021: symbol already defined: "siren"
C:\Program Files\GTA\server\gamemodes\dnrp1.pwn(83256) : warning 203: symbol is never used: "siren"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase

Reply
#5

Oh god, look at the erros! You probably got another variable defined with the name "siren" and "SirenObject"! That means you got 2 of them, delete one of each!
Reply
#6

if i remove one it keeps saying
C:\Program Files\GTA\server\gamemodes\dnrp1.pwn(83256) : warning 203: symbol is never used: "siren"
Reply
#7

Try delete both variables:
new Siren[MAX_VEHICLES];
new SirenObject[MAX_VEHICLES];
Reply
#8

still same warning
Reply
#9

Search for "new siren;" or "#define siren"...

You created the "siren"-variable somewhere, find it and delete it!

Hope I could help!
Reply
#10

nope, didn't do that.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)