SA-MP Forums Archive
Problem in a CMD - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Problem in a CMD (/showthread.php?tid=326153)



Problem in a CMD - -CaRRoT - 16.03.2012

Well.. As you see in this Command..

PHP код:
    if(strcmp(cmd"/sbm"true) == 0)
    {
        if(
PlayerInfo[playerid][pAdmin] < 1339)
        {
            return 
SendClientMessage(playeridCOLOR_GREY," You're not authorized to use that command !");
        }
        new 
rtogglebid;
        
tmp strtok(cmdtextidx);
        
bid strvalEx(tmp);
        
tmp strtok(cmdtextidx);
        
rtoggle strvalEx(tmp);
        if(
bid <= || bid >= MAX_BUILDINGS)
        {
            return 
SendClientMessage(playeridCOLOR_GREY," USAGE: /sbm [buildingid] [0/1]");
        }
        if(
rtoggle 1)
        {
                
BInfo[bid][buRadio] = 0;
                
SendClientMessage(playeridCOLOR_GREY," You've turned off the radio in that building.");
                for(new 
i=0;i<MAX_PLAYERS;i++)
                {
                    if(
PlayerInfo[i][InBuilding] == bid)
                    {
                        
StopAudioStreamForPlayer(i);
                    }
                }
                return 
1;
        }
        
tmp strtok(cmdtextidx);
        if(
rtoggle >= 1)
        {
            return 
SendClientMessage(playeridCOLOR_GREY," USAGE: /sbm [buildingid] [0/1]");
        }
        
ShowPlayerDialog(playerid7331DIALOG_STYLE_INPUT"Enter the URL""Type in the link for the audio stream""Stream it""Cancel");
        
bEditing[playerid] = bid;
        return 
1;
    } 
-------- /sbm [ID] 0 Works Fine , But when i type /sbm id 1 it should show me a dialog , but it just keep showing me the USAGE not the dialog - Any help would be appreciated and rep+ - Thanks


Re: Problem in a CMD - Jonny5 - 16.03.2012

i read that code wrong sorry will update this in a sec


Re: Problem in a CMD - -CaRRoT - 16.03.2012

Nope - The same problem , No difference.


Re: Problem in a CMD - Jonny5 - 16.03.2012

sorry i misread this,
its hard for me when i dont use strokk

this should work,

pawn Код:
if(strcmp(cmd, "/sbm", true) == 0)
    {
        if(PlayerInfo[playerid][pAdmin] < 1339)
        {
            return SendClientMessage(playerid, COLOR_GREY," You're not authorized to use that command !");
        }
        new rtoggle, bid;
        tmp = strtok(cmdtext, idx);
        bid = strvalEx(tmp);
        tmp = strtok(cmdtext, idx);
        rtoggle = strvalEx(tmp);
        if(bid <= 0 || bid >= MAX_BUILDINGS)
        {
            return SendClientMessage(playerid, COLOR_GREY," USAGE: /sbm [buildingid] [0/1]");
        }
        if(rtoggle < 1)
        {
                BInfo[bid][buRadio] = 0;
                SendClientMessage(playerid, COLOR_GREY," You've turned off the radio in that building.");
                for(new i=0;i<MAX_PLAYERS;i++)
                {
                    if(PlayerInfo[i][InBuilding] == bid)
                    {
                        StopAudioStreamForPlayer(i);
                    }
                }
                return 1;
        }  
        if(rtoggle > 1)
        {
            return SendClientMessage(playerid, COLOR_GREY," USAGE: /sbm [buildingid] [0/1]");
        }
        ShowPlayerDialog(playerid, 7331, DIALOG_STYLE_INPUT, "Enter the URL", "Type in the link for the audio stream", "Stream it", "Cancel");
        bEditing[playerid] = bid;
        return 1;
    }