Problem with audio and tag mismatch.
#1

Hello, I'd like to get help with my script, it's a bit edited "Simple boombox system".
I just added 3D text, changed language and fixed some bugs. Problem is that everything works but music won't play for anyone. Also compiler gives me 3 warnings about tag mismatch.

Код:
(29) : warning 213: tag mismatch
(69) : warning 213: tag mismatch
(86) : warning 213: tag mismatch
Full code of script:
Код:
#define FILTERSCRIPT
// Incl
#include <a_samp>
#include <streamer>
#include <foreach>
#include <zcmd>
#include <sscanf2>

// Defs
#define COLOR_WHITE 0xFFFFFFFF
#define COLOR_RED 0xFF0000FF
#define COLOR_LIGHTBLUE 0x33CCFFFF
#define COLOR_GREY 0xAFAFAFFF

public OnPlayerConnect(playerid)
{
    DeletePVar(playerid, "BoomboxObject"); DeletePVar(playerid, "BoomboxURL");
    DeletePVar(playerid, "bposX"); DeletePVar(playerid, "bposY"); DeletePVar(playerid, "bposZ"); DeletePVar(playerid, "bboxareaid");
    DeletePVar(playerid, "author");
    if(IsValidDynamicObject(GetPVarInt(playerid, "BoomboxObject"))) DestroyDynamicObject(GetPVarInt(playerid, "BoomboxObject"));
    return 1;
}

public OnPlayerDisconnect(playerid)
{
	if(GetPVarType(playerid, "BoomboxObject"))
	{
		DestroyDynamicObject(GetPVarInt(playerid, "BoomboxObject"));
		DestroyDynamic3DTextLabel(GetPVarInt(playerid, "author"));
		if(GetPVarType(playerid, "bboxareaid"))
		{
   			foreach(new i : Player)
		    {
		    	if(IsPlayerInDynamicArea(i, GetPVarInt(playerid, "bboxareaid")))
		        {
		        	StopAudioStreamForPlayer(i);
				}
			}
		}
	}
	return 1;
}

CMD:speaker(playerid, params[])
{
	new name[MAX_PLAYER_NAME];
	GetPlayerName(playerid, name, sizeof(name));
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "[GrandProject] Для доступа к данной команде нужен клиренс RCON уровня.");
	new string[128];
	if(!GetPVarType(playerid, "BoomboxObject"))
	{
	    if(sscanf(params, "s[256]", params)) return SendClientMessage(playerid, COLOR_RED, "[SH-SS][Помощь]: /speaker [URL]");
		foreach(new i : Player)
	    {
	        if(GetPVarType(i, "BoomboxObject"))
	        {
    			if(IsPlayerInRangeOfPoint(playerid, 40.0, GetPVarFloat(i, "bposX"), GetPVarFloat(i, "bposY"), GetPVarFloat(i, "bposZ")))
				{
				    SendClientMessage(playerid, COLOR_GREY, "[SH-SS] Рядом где-то уже есть спикер. Поставьте где-нибудь в другом месте.");
				    return 1;
				}
			}
		}

		new Float:x, Float:y, Float:z, Float:a;
	    GetPlayerPos(playerid, x, y, z); GetPlayerFacingAngle(playerid, a);
	    SetPVarInt(playerid, "BoomboxObject", CreateDynamicObject(2103, x, y, z, 0.0, 0.0, 0.0, .worldid = GetPlayerVirtualWorld(playerid), .interiorid = GetPlayerInterior(playerid)));
   		format(string, sizeof(string), "{FFFFFF}[SH-SS] Колонку поставил\n{FF0000}куратор %s", name);
		SetPVarInt(playerid, "author", CreateDynamic3DTextLabel(string, 0xFFFFFFFF, x, y, z + 1.0, 20, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, .worldid = GetPlayerVirtualWorld(playerid), .interiorid = GetPlayerInterior(playerid)));
	    SetPVarFloat(playerid, "bposX", x); SetPVarFloat(playerid, "bposY", y); SetPVarFloat(playerid, "bposZ", z);
		SetPVarInt(playerid, "bboxareaid", CreateDynamicSphere(x, y, z, 40.0, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid)));
	    format(string, sizeof(string), "[SH-SS] Колонка выставлена на вашей позиции.");
	    SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
	    foreach(new i : Player)
		{
			if(IsPlayerInDynamicArea(i, GetPVarInt(playerid, "bboxareaid")))
			{
				PlayAudioStreamForPlayer(i, params, GetPVarFloat(playerid, "bposX"), GetPVarFloat(playerid, "bposY"), GetPVarFloat(playerid, "bposZ"), 30.0, 1);
			}
    	}
		SetPVarString(playerid, "BoomboxURL", params);
	}
	else
	{
	    DestroyDynamicObject(GetPVarInt(playerid, "BoomboxObject"));
	    DestroyDynamic3DTextLabel(GetPVarInt(playerid, "author"));
	    DeletePVar(playerid, "BoomboxObject"); DeletePVar(playerid, "BoomboxURL");
	    DeletePVar(playerid, "bposX"); DeletePVar(playerid, "bposY"); DeletePVar(playerid, "bposZ");
	    if(GetPVarType(playerid, "bboxareaid"))
	    {
	        foreach(new i : Player)
	        {
	            if(IsPlayerInDynamicArea(i, GetPVarInt(playerid, "bboxareaid")))
	            {
	                StopAudioStreamForPlayer(i);
				}
			}
	        DeletePVar(playerid, "bboxareaid");
		}
		SendClientMessage(playerid, COLOR_LIGHTBLUE, "[SH-SS] Спикер убран.");
	}
	return 1;
}

CMD:setmusic(playerid, params[])
{
    new name[MAX_PLAYER_NAME];
	GetPlayerName(playerid, name, sizeof(name));
	if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "[GrandProject] Для доступа к данной команде нужен клиренс RCON уровня.");
	if(!GetPVarType(playerid, "BoomboxObject")) return SendClientMessage(playerid, COLOR_GREY, "[SH-SS] У Вас нет спикера.");
    if(sscanf(params, "s[256]", params)) return SendClientMessage(playerid, COLOR_WHITE, "[SH-SS][Помощь]: /setmusic [URL]");
    SendClientMessage(playerid, COLOR_GREY, "[SH-SS] Музыка успешно изменена.");
    foreach(new i : Player)
	{
		if(IsPlayerInDynamicArea(i, GetPVarInt(playerid, "bboxareaid")))
		{
			PlayAudioStreamForPlayer(i, params, GetPVarFloat(playerid, "bposX"), GetPVarFloat(playerid, "bposY"), GetPVarFloat(playerid, "bposZ"), 30.0, 1);
		}
    }
	SetPVarString(playerid, "BoomboxURL", params);
	return 1;
}

public OnPlayerEnterDynamicArea(playerid, areaid)
{
	foreach(new i : Player)
	{
	    if(GetPVarType(i, "bboxareaid"))
	    {
	        new station[256];
	        GetPVarString(i, "BoomboxURL", station, sizeof(station));
	        if(areaid == GetPVarInt(i, "bboxareaid"))
	        {
	            PlayAudioStreamForPlayer(playerid, station, GetPVarFloat(i, "bposX"), GetPVarFloat(i, "bposY"), GetPVarFloat(i, "bposZ"), 30.0, 1);
				return 1;
	        }
	    }
	}
	return 1;
}

public OnPlayerLeaveDynamicArea(playerid, areaid)
{
    foreach(new i : Player)
	{
	    if(GetPVarType(i, "bboxareaid"))
	    {
	        if(areaid == GetPVarInt(i, "bboxareaid"))
	        {
	            StopAudioStreamForPlayer(playerid);
				return 1;
	        }
	    }
	}
	return 1;
}
What's the problem? Thanks for help.
Reply


Messages In This Thread
Problem with audio and tag mismatch. - by andrikela - 29.08.2017, 16:57
Re: Problem with audio and tag mismatch. - by Kane - 30.08.2017, 08:32
Re: Problem with audio and tag mismatch. - by andrikela - 30.08.2017, 08:39
Re: Problem with audio and tag mismatch. - by Dayrion - 30.08.2017, 10:17
Re: Problem with audio and tag mismatch. - by andrikela - 30.08.2017, 11:39
Re: Problem with audio and tag mismatch. - by andrikela - 05.09.2017, 10:46

Forum Jump:


Users browsing this thread: 1 Guest(s)