siren bug
#1

"/siren off" does not work

Код:
CMD:siren(playerid, params[])
{
	new msg[100];
	new Siren[MAX_VEHICLES];
	new SirenObject[MAX_VEHICLES];
	new veh;
	new type[8];
   	if(PlayerInfo[playerid][pFaction] == 1 || PlayerInfo[playerid][pFaction] == 2 || PlayerInfo[playerid][pFaction] == 4) return SendClientMessage(playerid, COLOR_GREY, "Nu esti membru al factiunii LSPD/LSFD/GOV.");
   	if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, COLOR_GREY, "Nu conduci o masina.");
	if(sscanf(params, "s[8]", type))
	{
		SendClientMessage(playerid, COLOR_WHITE, "USAGE: /siren [position]");
		SendClientMessage(playerid, COLOR_WHITE, "POSITIONS: inside | roof | off");
		return 1;
	}
	if(Siren[veh]) return SendClientMessage(playerid, COLOR_GREY, "This vehicle already has a siren attached.");
	veh = GetPlayerVehicleID(playerid);
	if(!strcmp(type, "inside"))
	{
		if(Siren[veh]) return SendClientMessage(playerid, COLOR_GREY, "There is already a siren attached to this vehicle.");
        Siren[veh] = 1;
        SirenObject[veh] = CreateDynamicObject(18646, 10.0, 10.0, 10.0, 0, 0, 0);
        AttachDynamicObjectToVehicle(SirenObject[veh], veh, 0.0, 0.75, 0.275, 0.0, 0.1, 0.0); // Inside - Premier
  		format(msg, sizeof(msg), "** %s ataseaza sirena pe pervizul masinii.", GetNameWithSpace(playerid, 1));
    	ProxDetector(12, playerid, msg, COLOR_PINK);
        return 1;
	}
	else if(!strcmp(type, "roof"))
	{
	    if(Siren[veh]) return SendClientMessage(playerid, COLOR_GREY, "There is already a siren attached to this vehicle.");
		Siren[veh] = 2;
        SirenObject[veh] = CreateDynamicObject(18646, 10.0, 10.0, 10.0, 0, 0, 0);
        AttachDynamicObjectToVehicle(SirenObject[veh], veh, -0.43, 0.0, 0.785, 0.0, 0.1, 0.0);
  		format(msg, sizeof(msg), "** %s ataseaza sirena pe capota masinii.", GetNameWithSpace(playerid, 1));
    	ProxDetector(12, playerid, msg, COLOR_PINK);
        return 1;
	}
	else if(!strcmp(type, "off"))
	{
	    if(!Siren[veh]) return SendClientMessage(playerid, COLOR_GREY, "There is no siren attached to this vehicle.");
		Siren[veh] = 0;
		DestroyDynamicObject(SirenObject[veh]);
			    format(msg, sizeof(msg), "** %s apuca sirena urmand sa o puna la pozitia initiala.", GetNameWithSpace(playerid, 1));
			    ProxDetector(12, playerid, msg, COLOR_PINK);
		return 1;
	}
	return 1;
}
Reply
#2

You do realize that you declare "Siren" as a local variable so every value of the array is basically 0, right?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)