Problems with commands
#1

pawn Код:
C:\Users\Public\Videos\Sample Videos\pawno\troll.pwn(43) : error 010: invalid function or declaration
C:\Users\Public\Videos\Sample Videos\pawno\troll.pwn(47) : error 010: invalid function or declaration
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


2 Errors.
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext,"/troll",true)==0)
    {
        if(IsPlayerAdmin(playerid))
        {
            new string[128];
            new adminname[MAX_PLAYER_NAME];
            for (new i = 0; i != MAX_PLAYERS; ++i)
            {
                if (IsPlayerConnected(i))
                {
                    PlayAudioStreamForPlayer(i, "https://soundcloud.com/bigred9921/u-mad-bro-song-by-teamheadkick/download");
                    GetPlayerName(playerid, adminname, sizeof(adminname));
                    format(string, sizeof(string), "[TROLL]RCON Administrator %s(ID:%d) has trolled you! Type /stopmusic if you don't like the music!", adminname, adminname);
                    }
                }
            }
        }
    }
   
    if(strcmp(cmdtext,"/stopmusic",true)==0)
    {
        StopAudioStreamForPlayer(playerid);
        SendClientMessage(playerid, awesome_blue, "Troll music stopped!);
        return 1;
        }
    }
}
How do i fix this?
Reply
#2

Hi zack. It's me juNkiez from minecraft if you remember me. Friends with noah xD!

Please switch to ZCMD. Strtok or whatever its called is very slow.
Also, post the lines number
Reply
#3

Yeah i remember you. Line 43 is if(strcmp(cmdtext,"/stopmusic",true)==0) and 47 is return 1;
Reply
#4

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext,"/troll",true)==0)
    {
        if(IsPlayerAdmin(playerid))
        {
            new string[128];
            new adminname[MAX_PLAYER_NAME];
            for (new i = 0; i != MAX_PLAYERS; ++i)
            {
                if (IsPlayerConnected(i))
                {
                    PlayAudioStreamForPlayer(i, "https://soundcloud.com/bigred9921/u-mad-bro-song-by-teamheadkick/download");
                    GetPlayerName(playerid, adminname, sizeof(adminname));
                    format(string, sizeof(string), "[TROLL]RCON Administrator %s(ID:%d) has trolled you! Type /stopmusic if you don't like the music!", adminname, adminname);
                }
            }
        }
        return 1;
    }
   
    if(strcmp(cmdtext,"/stopmusic",true)==0)
    {
        StopAudioStreamForPlayer(playerid);
        SendClientMessage(playerid, awesome_blue, "Troll music stopped!");
        return 1;
    }
    return 0;
 }
Reply
#5

Switch to ZCMD
https://sampforum.blast.hk/showthread.php?tid=91354
Reply
#6

You forgot to return 1; the first command.

pawn Код:
CMD:troll(playerid, params[])
    {
        if(IsPlayerAdmin(playerid))
        {
            new string[128];
            new adminname[MAX_PLAYER_NAME];
            for (new i = 0; i != MAX_PLAYERS; ++i)
            {
                if (IsPlayerConnected(i))
                {
                    PlayAudioStreamForPlayer(i, "https://soundcloud.com/bigred9921/u-mad-bro-song-by-teamheadkick/download");
                    GetPlayerName(playerid, adminname, sizeof(adminname));
                    format(string, sizeof(string), "[TROLL]RCON Administrator %s(ID:%d) has trolled you! Type /stopmusic if you don't like the music!", adminname, adminname);
                    }
                }
            }
        }
        return 1;
    }

CMD:stopmusic(playerid, params[])
    {
        StopAudioStreamForPlayer(playerid);
        SendClientMessage(playerid, awesome_blue, "Troll music stopped!");
        return 1;
        }
    }
}
Reply
#7

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext,"/troll",true)==0)
    {
        if(IsPlayerAdmin(playerid))
        {
            new string[128];
            new adminname[MAX_PLAYER_NAME];
            for (new i = 0; i != MAX_PLAYERS; ++i)
            {
                if (IsPlayerConnected(i))
                {
                    PlayAudioStreamForPlayer(i, "https://soundcloud.com/bigred9921/u-mad-bro-song-by-teamheadkick/download");
                    GetPlayerName(playerid, adminname, sizeof(adminname));
                    format(string, sizeof(string), "[TROLL]RCON Administrator %s(ID:%d) has trolled you! Type /stopmusic if you don't like the music!", adminname, playerid);
                }
            }
        }
        return 1;
    }
   
    if(strcmp(cmdtext,"/stopmusic",true)==0)
    {
        StopAudioStreamForPlayer(playerid);
        SendClientMessage(playerid, awesome_blue, "Troll music stopped!);
        return 1;
    }
}
Reply
#8

Thanks all of you
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)