SA-MP Forums Archive
Invalid func or declaration - 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: Invalid func or declaration (/showthread.php?tid=409130)



Invalid func or declaration - Sellize - 20.01.2013

pawn Код:
CMD:mute(playerid, params[])
{
    #if defined mute
    new targetid;
    new reason[128];
    new str[256];
    new AdminName[MAX_PLAYER_NAME];
    new Target[MAX_PLAYER_NAME];
    if(IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "You aren't authorized to use this command!");
    if(sscanf(params, "us[128]", targetid, reason)) return SendClientMessage(playerid, COLOR_GREY, "Usage:/mute (playerid/partofname) (reason)");
    else if(targetid == INVALID_PLAYER_ID) SendClientMessage(playerid, COLOR_RED, "[{B4B5B7}System{FF6347}]: {B4B5B7}Player not found!");
    else
    {
        GetPlayerName(playerid, AdminName, sizeof(AdminName));
        GetPlayerName(targetid, Target, sizeof(Target));
        format(str, sizeof(str), "[{B4B5B7}Admin{FF6347}]{B4B5B7}'%s has muted {FF6347}[{B4B5B7}Player{FF6347}]{B4B5B7}'%s. {FF6347}Reason; {B4B5B7}%s .", AdminName, targetid, reason);
        SendClientMessageToAll(COLOR_RED, str);
        Info[targetid][isMuted] = 1;
    #endif
    }
    return 1;
}
It says invalid function or declaration @ the return 1;


Re: Invalid func or declaration - InfiniTy. - 20.01.2013

Quote:
Originally Posted by Sellize
Посмотреть сообщение
pawn Код:
CMD:mute(playerid, params[])
{
    #if defined mute
    new targetid;
    new reason[128];
    new str[256];
    new AdminName[MAX_PLAYER_NAME];
    new Target[MAX_PLAYER_NAME];
    if(IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "You aren't authorized to use this command!");
    if(sscanf(params, "us[128]", targetid, reason)) return SendClientMessage(playerid, COLOR_GREY, "Usage:/mute (playerid/partofname) (reason)");
    else if(targetid == INVALID_PLAYER_ID) SendClientMessage(playerid, COLOR_RED, "[{B4B5B7}System{FF6347}]: {B4B5B7}Player not found!");
    else
    {
        GetPlayerName(playerid, AdminName, sizeof(AdminName));
        GetPlayerName(targetid, Target, sizeof(Target));
        format(str, sizeof(str), "[{B4B5B7}Admin{FF6347}]{B4B5B7}'%s has muted {FF6347}[{B4B5B7}Player{FF6347}]{B4B5B7}'%s. {FF6347}Reason; {B4B5B7}%s .", AdminName, targetid, reason);
        SendClientMessageToAll(COLOR_RED, str);
        Info[targetid][isMuted] = 1;
    #endif
    }
    return 1;
}
It says invalid function or declaration @ the return 1;
pawn Код:
CMD:mute(playerid, params[])
{
    #if defined mute
    new targetid;
    new reason[128];
    new str[256];
    new AdminName[MAX_PLAYER_NAME];
    new Target[MAX_PLAYER_NAME];
    if(IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "You aren't authorized to use this command!");
    if(sscanf(params, "us[128]", targetid, reason)) return SendClientMessage(playerid, COLOR_GREY, "Usage:/mute (playerid/partofname) (reason)");
    else if(targetid == INVALID_PLAYER_ID) SendClientMessage(playerid, COLOR_RED, "[{B4B5B7}System{FF6347}]: {B4B5B7}Player not found!");
    else
    {
        GetPlayerName(playerid, AdminName, sizeof(AdminName));
        GetPlayerName(targetid, Target, sizeof(Target));
        format(str, sizeof(str), "[{B4B5B7}Admin{FF6347}]{B4B5B7}'%s has muted {FF6347}[{B4B5B7}Player{FF6347}]{B4B5B7}'%s. {FF6347}Reason; {B4B5B7}%s .", AdminName, targetid, reason);
        SendClientMessageToAll(COLOR_RED, str);
        Info[targetid][isMuted] = 1;
    }
    #endif
    return 1;
}



Re: Invalid func or declaration - DaRk_RaiN - 20.01.2013

pawn Код:
CMD:mute(playerid, params[])
{
    #if defined mute
    new targetid;
    new reason[128];
    new str[256];
    new AdminName[MAX_PLAYER_NAME];
    new Target[MAX_PLAYER_NAME];
    if(IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "You aren't authorized to use this command!");
    if(sscanf(params, "us[128]", targetid, reason)) return SendClientMessage(playerid, COLOR_GREY, "Usage:/mute (playerid/partofname) (reason)");
    else if(targetid == INVALID_PLAYER_ID) SendClientMessage(playerid, COLOR_RED, "[{B4B5B7}System{FF6347}]: {B4B5B7}Player not found!");
    else
    {
        GetPlayerName(playerid, AdminName, sizeof(AdminName));
        GetPlayerName(targetid, Target, sizeof(Target));
        format(str, sizeof(str), "[{B4B5B7}Admin{FF6347}]{B4B5B7}'%s has muted {FF6347}[{B4B5B7}Player{FF6347}]{B4B5B7}'%s. {FF6347}Reason; {B4B5B7}%s .", AdminName, targetid, reason);
        SendClientMessageToAll(COLOR_RED, str);
        Info[targetid][isMuted] = 1;
    #endif
    return 1;
}



Re: Invalid func or declaration - Infinity90 - 20.01.2013

I was too late lol


Re: Invalid func or declaration - InfiniTy. - 20.01.2013

Quote:
Originally Posted by DaRk_RaiN
Посмотреть сообщение
pawn Код:
CMD:mute(playerid, params[])
{
    #if defined mute
    new targetid;
    new reason[128];
    new str[256];
    new AdminName[MAX_PLAYER_NAME];
    new Target[MAX_PLAYER_NAME];
    if(IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "You aren't authorized to use this command!");
    if(sscanf(params, "us[128]", targetid, reason)) return SendClientMessage(playerid, COLOR_GREY, "Usage:/mute (playerid/partofname) (reason)");
    else if(targetid == INVALID_PLAYER_ID) SendClientMessage(playerid, COLOR_RED, "[{B4B5B7}System{FF6347}]: {B4B5B7}Player not found!");
    else
    {
        GetPlayerName(playerid, AdminName, sizeof(AdminName));
        GetPlayerName(targetid, Target, sizeof(Target));
        format(str, sizeof(str), "[{B4B5B7}Admin{FF6347}]{B4B5B7}'%s has muted {FF6347}[{B4B5B7}Player{FF6347}]{B4B5B7}'%s. {FF6347}Reason; {B4B5B7}%s .", AdminName, targetid, reason);
        SendClientMessageToAll(COLOR_RED, str);
        Info[targetid][isMuted] = 1;
    #endif
    return 1;
}
You forgot the } before #endif


Re: Invalid func or declaration - Sellize - 20.01.2013

Thanks man rep foar yoo
Quote:
Originally Posted by Adytza.
Посмотреть сообщение
You forgot the } before #endif



Re: Invalid func or declaration - Jakku - 20.01.2013

pawn Код:
CMD:mute(playerid, params[])
{
    #if defined mute
    new targetid;
    new reason[128];
    new str[256];
    new AdminName[MAX_PLAYER_NAME];
    new Target[MAX_PLAYER_NAME];
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "You aren't authorized to use this command!");
    if(sscanf(params, "us[128]", targetid, reason)) return SendClientMessage(playerid, COLOR_GREY, "Usage:/mute (playerid/partofname) (reason)");
    if (!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_GRAY, "User not connected");
    GetPlayerName(playerid, AdminName, sizeof(AdminName));
    GetPlayerName(targetid, Target, sizeof(Target));
    format(str, sizeof(str), "[{B4B5B7}Admin{FF6347}]{B4B5B7}'%s has muted {FF6347}[{B4B5B7}Player{FF6347}]{B4B5B7}'%s. {FF6347}Reason; {B4B5B7}%s .", AdminName, targetid, reason);
    SendClientMessageToAll(COLOR_RED, str);
    Info[targetid][isMuted] = 1;
    #endif
    return 1;
}
And next time, do not join my server for scripting help.