Help With Error please
#1

I just used a command "red alert" can you help me with this command please
The error i getting

Код:
C:\Documents and Settings\GOD\Desktop\MY GM\gamemodes\wow.pwn(602) : warning 225: unreachable code
C:\Documents and Settings\GOD\Desktop\MY GM\gamemodes\wow.pwn(623) : warning 225: unreachable code
C:\Documents and Settings\GOD\Desktop\MY GM\gamemodes\wow.pwn(623) : warning 217: loose indentation
C:\Documents and Settings\GOD\Desktop\MY GM\gamemodes\wow.pwn(3770) : warning 235: public function lacks forward declaration (symbol "KickAll")
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Warnings.
The code lines
pawn Код:
CMD:redalert(playerid, params[])
    {
      if(IsPlayerAdmin(playerid))
      {
        new string[256];
        new aname[256];
        GetPlayerName(playerid,aname,sizeof(aname));
        GameTextForAll("~r~Red Alert",7000,4);
        format(string,sizeof(string), "Admin: %s has called Red Alert",aname);
        SendClientMessageToAll(0xAA3333AA,string);
        SendClientMessageToAll(0xAA3333AA,"You will all be kicked in ten seconds.");
        RedAlertTimer = SetTimer("KickAll",10000,0);
        SendClientMessage(playerid, 0xFFFF00AA, "Red Alert Successful. To Abort Type /abort");
        printf("%s has initialized the red alert countdown.",aname);
        return 1;
      }
      else
      {
        return 0;
      }
      return 1;
    }
 
 CMD:abort(playerid, params[])
    {
      if(IsPlayerAdmin(playerid))
      {
        new string[256];
        new aname[256];
        GetPlayerName(playerid,aname,sizeof(aname));
        GameTextForAll("~y~Red Alert Aborted",7000,4);
        format(string,sizeof(string), "Admin: %s has canceled the Red Alert",aname);
        SendClientMessageToAll(0x33AA33AA,string);
        KillTimer(RedAlertTimer);
        SendClientMessage(playerid, 0xFFFF00AA, "Red Alert Abort Successful.");
        printf("%s has cancelled the red alert countdown.",aname);
        return 1;
        }
        else
        {
          return 0;
        }
        return 1;
       }



    public KickAll()
{
    for (new i = 0; i < MAX_PLAYERS; i++)
    {
        if (IsPlayerConnected(i))
        {
            Kick(i);
        }
    }
}
I hope you can help me guys
Thanks in advance
Reply
#2

Try removing return 1; from

pawn Код:
if(IsPlayerAdmin(playerid))
      {
        new string[256];
        new aname[256];
        GetPlayerName(playerid,aname,sizeof(aname));
        GameTextForAll("~r~Red Alert",7000,4);
        format(string,sizeof(string), "Admin: %s has called Red Alert",aname);
        SendClientMessageToAll(0xAA3333AA,string);
        SendClientMessageToAll(0xAA3333AA,"You will all be kicked in ten seconds.");
        RedAlertTimer = SetTimer("KickAll",10000,0);
        SendClientMessage(playerid, 0xFFFF00AA, "Red Alert Successful. To Abort Type /abort");
        printf("%s has initialized the red alert countdown.",aname);
        return 1;
      }
and

pawn Код:
if(IsPlayerAdmin(playerid))
      {
        new string[256];
        new aname[256];
        GetPlayerName(playerid,aname,sizeof(aname));
        GameTextForAll("~r~Red Alert",7000,4);
        format(string,sizeof(string), "Admin: %s has called Red Alert",aname);
        SendClientMessageToAll(0xAA3333AA,string);
        SendClientMessageToAll(0xAA3333AA,"You will all be kicked in ten seconds.");
        RedAlertTimer = SetTimer("KickAll",10000,0);
        SendClientMessage(playerid, 0xFFFF00AA, "Red Alert Successful. To Abort Type /abort");
        printf("%s has initialized the red alert countdown.",aname);
        return 1;
      }
the public faction error is you don't have the

pawn Код:
forward KickAll();
the loose intendation is were your code is not in the right line idk about this one
Reply
#3

After that
pawn Код:
C:\Documents and Settings\GOD\Desktop\MY GM\gamemodes\wow.pwn(489) : error 004: function "DestroyObjects" is not implemented
C:\Documents and Settings\GOD\Desktop\MY GM\gamemodes\wow.pwn(538) : error 017: undefined symbol "StealthMode"
C:\Documents and Settings\GOD\Desktop\MY GM\gamemodes\wow.pwn(542) : error 017: undefined symbol "RevealPlayer"
C:\Documents and Settings\GOD\Desktop\MY GM\gamemodes\wow.pwn(549) : error 017: undefined symbol "RevealPlayer"
C:\Documents and Settings\GOD\Desktop\MY GM\gamemodes\wow.pwn(596) : warning 217: loose indentation
C:\Documents and Settings\GOD\Desktop\MY GM\gamemodes\wow.pwn(596) : error 079: inconsistent return types (array & non-array)
C:\Documents and Settings\GOD\Desktop\MY GM\gamemodes\wow.pwn(599) : error 029: invalid expression, assumed zero
C:\Documents and Settings\GOD\Desktop\MY GM\gamemodes\wow.pwn(599) : error 017: undefined symbol "cmd_abort"
C:\Documents and Settings\GOD\Desktop\MY GM\gamemodes\wow.pwn(599) : error 029: invalid expression, assumed zero
C:\Documents and Settings\GOD\Desktop\MY GM\gamemodes\wow.pwn(599) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


9 Errors.
Reply
#4

show me your code (the last one with errors not the first one that you post at the top)

did you did like this? don't tell me you remove the command return 1; too

pawn Код:
CMD:redalert(playerid, params[])
    {
      if(IsPlayerAdmin(playerid))
      {
        new string[256];
        new aname[256];
        GetPlayerName(playerid,aname,sizeof(aname));
        GameTextForAll("~r~Red Alert",7000,4);
        format(string,sizeof(string), "Admin: %s has called Red Alert",aname);
        SendClientMessageToAll(0xAA3333AA,string);
        SendClientMessageToAll(0xAA3333AA,"You will all be kicked in ten seconds.");
        RedAlertTimer = SetTimer("KickAll",10000,0);
        SendClientMessage(playerid, 0xFFFF00AA, "Red Alert Successful. To Abort Type /abort");
        printf("%s has initialized the red alert countdown.",aname);
      }
      else
      {
        return 0;
      }
    }
pawn Код:
CMD:abort(playerid, params[])
    {
      if(IsPlayerAdmin(playerid))
      {
        new string[256];
        new aname[256];
        GetPlayerName(playerid,aname,sizeof(aname));
        GameTextForAll("~y~Red Alert Aborted",7000,4);
        format(string,sizeof(string), "Admin: %s has canceled the Red Alert",aname);
        SendClientMessageToAll(0x33AA33AA,string);
        KillTimer(RedAlertTimer);
        SendClientMessage(playerid, 0xFFFF00AA, "Red Alert Abort Successful.");
        printf("%s has cancelled the red alert countdown.",aname);
        }
        else
        {
          return 0;
        }
       }
WRONG you doing it so wrong

this is the right version

pawn Код:
CMD:redalert(playerid, params[])
    {
      if(IsPlayerAdmin(playerid))
      {
        new string[256];
        new aname[256];
        GetPlayerName(playerid,aname,sizeof(aname));
        GameTextForAll("~r~Red Alert",7000,4);
        format(string,sizeof(string), "Admin: %s has called Red Alert",aname);
        SendClientMessageToAll(0xAA3333AA,string);
        SendClientMessageToAll(0xAA3333AA,"You will all be kicked in ten seconds.");
        RedAlertTimer = SetTimer("KickAll",10000,0);
        SendClientMessage(playerid, 0xFFFF00AA, "Red Alert Successful. To Abort Type /abort");
        printf("%s has initialized the red alert countdown.",aname);
      }
      else
      {
        return 0;
      }
      return 1;
    }

 CMD:abort(playerid, params[])
    {
      if(IsPlayerAdmin(playerid))
      {
        new string[256];
        new aname[256];
        GetPlayerName(playerid,aname,sizeof(aname));
        GameTextForAll("~y~Red Alert Aborted",7000,4);
        format(string,sizeof(string), "Admin: %s has canceled the Red Alert",aname);
        SendClientMessageToAll(0x33AA33AA,string);
        KillTimer(RedAlertTimer);
        SendClientMessage(playerid, 0xFFFF00AA, "Red Alert Abort Successful.");
        printf("%s has cancelled the red alert countdown.",aname);
        }
        else
        {
          return 0;
        }
        return 1;
       }
for the public function error heres the simple and easy way to fix it
add forward KickAll(); in the top of public KickAll() like this

pawn Код:
forward KickAll();
public KickAll()
hope its clear to you know
Reply
#5

by the way i need a rep to improve my great in scripting
give me a rep by clicking the star near on online button

- only click it if i ever help you. i try all my best.
Reply
#6

Thanks it Worked
Reply
#7

Edit: Too late! I didn't see, it solved.
pawn Код:
CMD:redalert(playerid, params[])
{
    if(!IsPlayerAdmin(playerid)) return 0;
    new string[128], aname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, aname, sizeof(aname));
    GameTextForAll("~r~Red Alert", 7000, 4);
    format(string, sizeof(string), "Admin: %s has called Red Alert", aname);
    SendClientMessageToAll(0xAA3333AA, string);
    SendClientMessageToAll(0xAA3333AA, "You will all be kicked in ten seconds.");
    RedAlertTimer = SetTimer("KickAll", 10000, 0);
    SendClientMessage(playerid, 0xFFFF00AA, "Red Alert Successful. To Abort Type /abort");
    printf("%s has initialized the red alert countdown.", aname);
    return 1;
}
CMD:abort(playerid, params[])
{
    if(!IsPlayerAdmin(playerid)) return 0;
    new string[128], aname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, aname, sizeof(aname));
    GameTextForAll("~y~Red Alert Aborted", 7000, 4);
    format(string, sizeof(string), "Admin: %s has canceled the Red Alert", aname);
    SendClientMessageToAll(0x33AA33AA, string);
    KillTimer(RedAlertTimer);
    SendClientMessage(playerid, 0xFFFF00AA, "Red Alert Abort Successful.");
    printf("%s has cancelled the red alert countdown.", aname);
    return 1;
}

forward KickAll();
public KickAll()
{
    for(new i = 0; i < MAX_PLAYERS; i++) {
        if(IsPlayerConnected(i)) {
            Kick(i);
        }
    }
}
Reply
#8

Quote:
Originally Posted by Dwane
Посмотреть сообщение
Edit: Too late! I didn't see, it solved.
pawn Код:
CMD:redalert(playerid, params[])
{
    if(!IsPlayerAdmin(playerid)) return 0;
    new string[128], aname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, aname, sizeof(aname));
    GameTextForAll("~r~Red Alert", 7000, 4);
    format(string, sizeof(string), "Admin: %s has called Red Alert", aname);
    SendClientMessageToAll(0xAA3333AA, string);
    SendClientMessageToAll(0xAA3333AA, "You will all be kicked in ten seconds.");
    RedAlertTimer = SetTimer("KickAll", 10000, 0);
    SendClientMessage(playerid, 0xFFFF00AA, "Red Alert Successful. To Abort Type /abort");
    printf("%s has initialized the red alert countdown.", aname);
    return 1;
}
CMD:abort(playerid, params[])
{
    if(!IsPlayerAdmin(playerid)) return 0;
    new string[128], aname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, aname, sizeof(aname));
    GameTextForAll("~y~Red Alert Aborted", 7000, 4);
    format(string, sizeof(string), "Admin: %s has canceled the Red Alert", aname);
    SendClientMessageToAll(0x33AA33AA, string);
    KillTimer(RedAlertTimer);
    SendClientMessage(playerid, 0xFFFF00AA, "Red Alert Abort Successful.");
    printf("%s has cancelled the red alert countdown.", aname);
    return 1;
}

forward KickAll();
public KickAll()
{
    for(new i = 0; i < MAX_PLAYERS; i++) {
        if(IsPlayerConnected(i)) {
            Kick(i);
        }
    }
}
no dude your not to late we have more new beginners scripter are needing our help which means its not to late to help someone keep your great work Dwane
Reply
#9

Quote:
Originally Posted by ScriptJorkis
Посмотреть сообщение
by the way i need a rep to improve my great in scripting
give me a rep by clicking the star near on online button

- only click it if i ever help you. i try all my best.
Asking for Rep. doesn't get you rep. it gets you banned, you earn rep. here at SAMP forums.
Reply
#10

i didn't i just want to help scripters i just want one rep just one rep to feel good
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)