1 error very simple help me
#1

Hey guys so you can understand what i am currently creating.

here is my code:

and on top:
pawn Код:
new dday;
pawn Код:
public Dday(playerid)
{
    switch(dday)
    {
        case 0:
        {
            SetPlayerTeam(playerid, 0);
            SetPlayerColor(playerid, 0xFF0000FF); // Red
            SetPlayerVirtualWorld(playerid, 3);
            GameTextForPlayer(playerid,"You're ~r~Attacker. ~g~Go Attack them..",2000,3);
        }
        case 1:
        {
            SetPlayerTeam(playerid, 1);
            SetPlayerColor(playerid, 0x00FF00FF); // Green
            SetPlayerVirtualWorld(playerid, 3);
            GameTextForPlayer(playerid,"You're ~g~Defender. ~g~Go Defend them..",2000,3);
        }
    return dday;
}
and the errors:

Код:
C:\Users\Axme\Desktop\Server\gamemodes\Hydraffs.pwn(676) : error 002: only a single statement (or expression) can follow each "case"
Line 676 = return dday;

thanks
Reply
#2

pawn Код:
public Dday(playerid)
{
    switch(dday)
    {
        case 0:
        {
            SetPlayerTeam(playerid, 0);
            SetPlayerColor(playerid, 0xFF0000FF); // Red
            SetPlayerVirtualWorld(playerid, 3);
            GameTextForPlayer(playerid,"You're ~r~Attacker. ~g~Go Attack them..",2000,3);
        }
        case 1:
        {
            SetPlayerTeam(playerid, 1);
            SetPlayerColor(playerid, 0x00FF00FF); // Green
            SetPlayerVirtualWorld(playerid, 3);
            GameTextForPlayer(playerid,"You're ~g~Defender. ~g~Go Defend them..",2000,3);
        }

    }
    return dday;
}
You forgot a bracket for the switch.
Reply
#3

you forgot a }
pawn Код:
public Dday(playerid)
{
    switch(dday)
    {
        case 0:
        {
            SetPlayerTeam(playerid, 0);
            SetPlayerColor(playerid, 0xFF0000FF); // Red
            SetPlayerVirtualWorld(playerid, 3);
            GameTextForPlayer(playerid,"You're ~r~Attacker. ~g~Go Attack them..",2000,3);
        }
        case 1:
        {
            SetPlayerTeam(playerid, 1);
            SetPlayerColor(playerid, 0x00FF00FF); // Green
            SetPlayerVirtualWorld(playerid, 3);
            GameTextForPlayer(playerid,"You're ~g~Defender. ~g~Go Defend them..",2000,3);
        }
    } //-- here
    return dday;
}
edit: hm jay was faster
Reply
#4

Oh thank you both.

This helped me lol.

Thanks
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)