PDA

View Full Version : /siren script won't work.


Frank Biohazard
02/03/2012, 07:59 AM
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_PURPL E,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_PURPL E,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_PURPL E,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 (c) 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?

Drebin
02/03/2012, 08:13 AM
You simply defined the variable "siren" but never used it in the script.

Twisted_Insane
02/03/2012, 08:23 AM
Delete that line:

new Siren[MAX_VEHICLES];

Frank Biohazard
02/03/2012, 08:53 AM
then i get this:

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 (c) 1997-2006, ITB CompuPhase

Twisted_Insane
02/03/2012, 08:57 AM
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! :D

Frank Biohazard
02/03/2012, 08:58 AM
if i remove one it keeps saying
C:\Program Files\GTA\server\gamemodes\dnrp1.pwn(83256) : warning 203: symbol is never used: "siren"

SomebodyAndMe
02/03/2012, 08:59 AM
Try delete both variables:
new Siren[MAX_VEHICLES];
new SirenObject[MAX_VEHICLES];

Frank Biohazard
02/03/2012, 09:01 AM
still same warning

Twisted_Insane
02/03/2012, 09:04 AM
Search for "new siren;" or "#define siren"...

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

Hope I could help!:D

Frank Biohazard
02/03/2012, 09:05 AM
nope, didn't do that.

SomebodyAndMe
02/03/2012, 09:06 AM
Frank, read your pm...

ShOoBy
02/03/2012, 09:26 AM
Simple . On top of your script after all the includes and defines, add :
#pragma unused siren

SomebodyAndMe
02/03/2012, 09:56 AM
This is fixed now, he forgot to #include <zcmd> that's why the warning symbol siren never used..

because: CMD:siren is zcmd. And he didn't add that.