Commands not working in filterscript
#1

What's wrong with this goddamn filterscript? I can't get it to work. 6 months ago commands were working with ZCMD, but music didn't stream, now commands aren't working at all (be it ZCMD or dc_cmd).
It's compiling without errors or warnings at all.

PHP код:
#define FILTERSCRIPT
// Incl
#include <a_samp>
#include <dc_cmd>
#include <streamer>
#include <foreach>
#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(Text3D: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[])
{
    if(!
IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "[GrandProject] Äëÿ äîñòóïà ê äàííîé êîìàíäå íóæåí êëèðåíñ RCON óðîâíÿ.");
    new 
name[MAX_PLAYER_NAME];
    
GetPlayerName(playerid, name, sizeof(name));
    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));
        
format(string, sizeof(string), "{FFFFFF}[SH-SS] Êîëîíêó ïîñòàâèë\n{FF0000}êóðàòîð %s", name);
        
SetPVarInt(playerid, "author", _:CreateDynamic3DTextLabel(string, 0xFFFFFFFF, x, y, z + 1.0, 20));
        
SetPVarFloat(playerid, "bposX", x); SetPVarFloat(playerid, "bposY", y); SetPVarFloat(playerid, "bposZ", z);
        
SetPVarInt(playerid, "bboxareaid", CreateDynamicSphere(x, y, z, 40.0));
        
format(string, sizeof(string), "[SH-SS] Êîëîíêà âûñòàâëåíà íà âàøåé ïîçèöèè.");
        
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
        
format(string, sizeof(string), "pos: %f, %f, %f pvarpos: %f, %f, %f", x, y, z, GetPVarFloat(playerid, "bposX"), GetPVarFloat(playerid, "bposY"), GetPVarFloat(playerid, "bposZ"));
        
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
        
SetPVarString(playerid, "BoomboxURL", params[0]);
        foreach(new 
i : Player)
        {
            if(
IsPlayerInDynamicArea(i, GetPVarInt(playerid, "bboxareaid")))
            {
                
PlayAudioStreamForPlayer(i, "http://air.radiorecord.ru:8101/rr_320", x, y, z, 30.0, 1);
            }
        }
        if(
IsValidDynamicArea(GetPVarInt(playerid, "bboxareaid"))) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "bboxareaid is valid");
        
format(string, sizeof(string), "Params BoomboxURL: %s", params[0]);
        
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
    }
    else
    {
        
DestroyDynamicObject(GetPVarInt(playerid, "BoomboxObject"));
        
DestroyDynamic3DTextLabel(Text3D: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[0], 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;
} 
Reply
#2

Replace the dc_cmd include with a ZCMD include and see if that yields any different results.

Also make sure you're actually loading the filterscript in your server.cfg file.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)