SA-MP Forums Archive
error 001: expected token: ";", but found "return" - 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: error 001: expected token: ";", but found "return" (/showthread.php?tid=421578)



error 001: expected token: ";", but found "return" - Eminem 2ka9 - 10.03.2013

This is my code:

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{

    if(!strcmp(cmdtext, "/dis", true))//dialog which tells u about the spy class disguises
        {

        if(gClass[playerid] == MEDIC)
        {
             ShowPlayerDialog(playerid, 88, DIALOG_STYLE_MSGBOX, "{6EF83C}Spy Disguise  Kit:", "/team1\n/team2\n/team3", "Disguise ","Exit");//Replace the team1,2,3 to your game teams name and colors, by /team1 or /team2 or / team3 the player gets disguise to enemy soldier but don't changes its team
             return 1;
        }
    }

        if(!strcmp(cmdtext, "/team1", true))//This is for disguise to team 1
        {

        if(gClass[playerid] == MEDIC)//if player class spy
        {
             ShowPlayerDialog(playerid, 11, DIALOG_STYLE_MSGBOX, "{6EF83C}Disguised to Team1:", "Team: Team1\nColor: Red\nSkin: 285\nDisguised Class: Soldier", "Ok ","");
             SetPlayerSkin(playerid,285);//skin set to S.W.A.T, can change to ur team skin
             SetPlayerColor(playerid,C_RED)//Color Red
             return 1;
        }
    }

    if(!strcmp(cmdtext, "/team2", true))//This is for disguise to team 2
        {

        if(gClass[playerid] == MEDIC)//if player class spy
        {
             ShowPlayerDialog(playerid, 22, DIALOG_STYLE_MSGBOX, "{6EF83C}Disguised to Team2:", "Team: Team2\nColor: White\nSkin: 287\nDisguised Class: Soldier", "Ok ","");
             SetPlayerSkin(playerid,287);//skin set to Military, can change to ur team skin
             SetPlayerColor(playerid,C_WHITE)//Color white
             return 1;
        }
    }

    if(!strcmp(cmdtext, "/team3", true))//This is for disguise to team 1
        {

        if(gClass[playerid] == MEDIC)//if player class spy
        {
             ShowPlayerDialog(playerid, 33, DIALOG_STYLE_MSGBOX, "{6EF83C}Disguised to Team3:", "Team: Team3\nColor: Green\nSkin: 181\nDisguised Class: Soldier", "Ok ","");
             SetPlayerSkin(playerid,181);//skin set to Rockstar, can change to ur team skin
             SetPlayerColor(playerid,C_GREEN)//Color green
             return 1;
        }
    }
    return 0;
}



Re: error 001: expected token: ";", but found "return" - lean1337 - 10.03.2013

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{

    if(!strcmp(cmdtext, "/dis", true))//dialog which tells u about the spy class disguises
        {

        if(gClass[playerid] == MEDIC)
        {
             ShowPlayerDialog(playerid, 88, DIALOG_STYLE_MSGBOX, "{6EF83C}Spy Disguise  Kit:", "/team1\n/team2\n/team3", "Disguise ","Exit");//Replace the team1,2,3 to your game teams name and colors, by /team1 or /team2 or / team3 the player gets disguise to enemy soldier but don't changes its team
             return 1;
        }
    }

        if(!strcmp(cmdtext, "/team1", true))//This is for disguise to team 1
        {

        if(gClass[playerid] == MEDIC)//if player class spy
        {
             ShowPlayerDialog(playerid, 11, DIALOG_STYLE_MSGBOX, "{6EF83C}Disguised to Team1:", "Team: Team1\nColor: Red\nSkin: 285\nDisguised Class: Soldier", "Ok ","");
             SetPlayerSkin(playerid,285);//skin set to S.W.A.T, can change to ur team skin
             SetPlayerColor(playerid,C_RED);//Color Red
             return 1;
        }
    }

    if(!strcmp(cmdtext, "/team2", true))//This is for disguise to team 2
        {

        if(gClass[playerid] == MEDIC)//if player class spy
        {
             ShowPlayerDialog(playerid, 22, DIALOG_STYLE_MSGBOX, "{6EF83C}Disguised to Team2:", "Team: Team2\nColor: White\nSkin: 287\nDisguised Class: Soldier", "Ok ","");
             SetPlayerSkin(playerid,287);//skin set to Military, can change to ur team skin
             SetPlayerColor(playerid,C_WHITE);//Color white
             return 1;
        }
    }

    if(!strcmp(cmdtext, "/team3", true))//This is for disguise to team 1
        {

        if(gClass[playerid] == MEDIC)//if player class spy
        {
             ShowPlayerDialog(playerid, 33, DIALOG_STYLE_MSGBOX, "{6EF83C}Disguised to Team3:", "Team: Team3\nColor: Green\nSkin: 181\nDisguised Class: Soldier", "Ok ","");
             SetPlayerSkin(playerid,181);//skin set to Rockstar, can change to ur team skin
             SetPlayerColor(playerid,C_GREEN);//Color green
             return 1;
        }
    }
    return 0;
}
Try this


Re: error 001: expected token: ";", but found "return" - Eminem 2ka9 - 10.03.2013

Thanks ton! Omg REP+!


Re: error 001: expected token: ";", but found "return" - Eminem 2ka9 - 10.03.2013

It compiles fine, but when i go in-game and type the command, it just says "command not found!"

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{

    if(!strcmp(cmdtext, "/disguise", true))//dialog which tells u about the spy class disguises
        {

        if(gClass[playerid] == SPY)
        {
             ShowPlayerDialog(playerid, 88, DIALOG_STYLE_MSGBOX, "{6EF83C}Spy - Disguise Kit:", "/England\n/Soviet Union\n/Taliban\n/United States\n/Australian Armada", "Disguise ","Exit");//Replace the team1,2,3 to your game teams name and colors, by /team1 or /team2 or / team3 the player gets disguise to enemy soldier but don't changes its team
             return 1;
        }
    }

    if(!strcmp(cmdtext, "/england", true))//This is for disguise to team 1
        {

        if(gClass[playerid] == SPY)//if player class spy
        {
             ShowPlayerDialog(playerid, 11, DIALOG_STYLE_MSGBOX, "{6EF83C}Disguise as England:", "Team: England\nColor: Green\nSkin: 124", "Disguise ","");
             SetPlayerSkin(playerid,124);//skin set to S.W.A.T, can change to ur team skin
             SetPlayerColor(playerid,C_GREEN);//Color Red
             return 1;
        }
    }

    if(!strcmp(cmdtext, "/sovietunion", true))//This is for disguise to team 2
        {

        if(gClass[playerid] == SPY)//if player class spy
        {
             ShowPlayerDialog(playerid, 22, DIALOG_STYLE_MSGBOX, "{6EF83C}Disguise as Soviet Union:", "Team: Soviet Union\nColor: Red\nSkin: 206", "Disguise ","");
             SetPlayerSkin(playerid,206);//skin set to Military, can change to ur team skin
             SetPlayerColor(playerid,C_RED);//Color white
             return 1;
        }
    }

    if(!strcmp(cmdtext, "/taliban", true))//This is for disguise to team 1
        {

        if(gClass[playerid] == SPY)//if player class spy
        {
             ShowPlayerDialog(playerid, 33, DIALOG_STYLE_MSGBOX, "{6EF83C}Disguise as Taliban:", "Team: Taliban\nColor: Yellow\nSkin: 128", "Disguise ","");
             SetPlayerSkin(playerid,128);//skin set to Rockstar, can change to ur team skin
             SetPlayerColor(playerid,C_YELLOW);//Color green
             return 1;
        }
    }
   
    if(!strcmp(cmdtext, "/unitedstates", true))//This is for disguise to team 2
        {

        if(gClass[playerid] == SPY)//if player class spy
        {
             ShowPlayerDialog(playerid, 22, DIALOG_STYLE_MSGBOX, "{6EF83C}Disguise as United States:", "Team: United States\nColor: Blue\nSkin: 103", "Disguise ","");
             SetPlayerSkin(playerid,103);//skin set to Military, can change to ur team skin
             SetPlayerColor(playerid,C_BLUE);//Color white
             return 1;
        }
    }
   
    if(!strcmp(cmdtext, "/australia", true))//This is for disguise to team 2
        {

        if(gClass[playerid] == SPY)//if player class spy
        {
             ShowPlayerDialog(playerid, 22, DIALOG_STYLE_MSGBOX, "{6EF83C}Disguise as Australian Armada:", "Team: Australian Armada\nColor: Purple\nSkin: 73", "Disguise ","");
             SetPlayerSkin(playerid,73);//skin set to Military, can change to ur team skin
             SetPlayerColor(playerid,C_PURPLE);//Color white
             return 1;
        }
    }
    return 0;
}



Re: error 001: expected token: ";", but found "return" - LarzI - 10.03.2013

Make sure you are a spy.


Re: error 001: expected token: ";", but found "return" - Eminem 2ka9 - 10.03.2013

I am, i even went to another class and still. I even have this "you cannot use this without SPY"

pawn Код:
if(!strcmp(cmdtext, "/taliban", true))//This is for disguise to team 1
        {

        if(gClass[playerid] == SPY)//if player class spy
        {
             ShowPlayerDialog(playerid, 33, DIALOG_STYLE_MSGBOX, "{6EF83C}Disguise as Taliban:", "Team: Taliban\nColor: Yellow\nSkin: 128", "Disguise ","");
             SetPlayerSkin(playerid,128);//skin set to Rockstar, can change to ur team skin
             SetPlayerColor(playerid,C_YELLOW);//Color green
             return 1;
        }
        SendClientMessage(playerid, C_RED, "You need to have SPY class to use this command");
    }



Re: error 001: expected token: ";", but found "return" - Scenario - 10.03.2013

pawn Код:
else SendClientMessage(playerid, C_RED, "You need to have SPY class to use this command");
instead of

pawn Код:
SendClientMessage(playerid, C_RED, "You need to have SPY class to use this command");



Re: error 001: expected token: ";", but found "return" - Eminem 2ka9 - 10.03.2013

It still did not prevent this issue.. i don't know what going on because it looks fine to me and seems fine to everyone here so!


Re: error 001: expected token: ";", but found "return" - LarzI - 10.03.2013

Quote:
Originally Posted by RealCop228
Посмотреть сообщение
pawn Код:
else SendClientMessage(playerid, C_RED, "You need to have SPY class to use this command");
instead of

pawn Код:
SendClientMessage(playerid, C_RED, "You need to have SPY class to use this command");
Doesn't really change anything as he returns the function if the statement falls through.