16.05.2012, 10:52
PHP код:
if(!strcmp(cmdtext, "/siren", true))
{
new skinid = GetPlayerSkin(playerid);
if(skinid == 265 || skinid == 266 || skinid == 284)
{
new string[128], type;
new VID = GetPlayerVehicleID(playerid);
if(sscanf(params, "d", type))// THIS IS THE ERROR LINE, THe params is undefined as said in the compilation result
{
SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /siren [type]");
SendClientMessage(playerid, 0xFF9900FF, "Type /credits to the person who made this");
return 1;
}
switch(type)
{
case 1:
{
if(Siren[VID] == 1)
{
SendClientMessage(playerid, 0xFF0000FF, "ERROR: 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 and begins to patrol", sendername);
ProxDetector(30.0, playerid, string, 0x00FF00FF,0x00FF00FF,0x00FF00FF,0x00FF00FF,0x00FF00FF);
return 1;
}
case 2:
{
if(Siren[VID] == 1)
{
SendClientMessage(playerid, 0xFF0000FF, "ERROR: 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 and begins to patrol", sendername);
ProxDetector(30.0, playerid, string, 0x00FF00FF,0x00FF00FF,0x00FF00FF,0x00FF00FF,0x00FF00FF);
return 1;
}
case 3:
{
if(Siren[VID] == 0)
{
SendClientMessage(playerid, 0xFF0000FF, "ERROR: 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 puts the siren off and is now off duty", sendername);
ProxDetector(30.0, playerid, string, 0x00FF00FF,0x00FF00FF,0x00FF00FF,0x00FF00FF,0x00FF00FF);
return 1;
}
default:
{
SendClientMessage(playerid, 0xFF0000FF, "ERROR: Invalid license type! /siren [type]");
SendClientMessage(playerid, 0xFF9900FF, "Type: 1 = Roof, 2 = Inside, 3 = Off.");
}
}
}
else SendClientMessage(playerid, 0xFF0000FF, "ERROR: You're not a member of the the Enforcer");
return 1;
}