SA-MP Forums Archive
simple error - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: simple error (/showthread.php?tid=275838)



simple error - Davz*|*Criss - 11.08.2011

here is my code

pawn Код:
public Dday(playerid)
{
    SetPlayerTeam(playerid, 0);
    SetPlayerColor(playerid, 0xFF0000FF); // Red
    SetPlayerVirtualWorld(playerid, 3);
    GameTextForPlayer(playerid,"You're ~r~Attacker. ~g~Go Attack them..",2000,3);
    SetPlayerPos(playerid, -143.5201,2462.7905,16.5642);
    }
    else
    {
    SetPlayerTeam(playerid, 1);
    SetPlayerColor(playerid, 0x00FF00FF); // Green
    SetPlayerVirtualWorld(playerid, 3);
    GameTextForPlayer(playerid,"You're ~g~Defender. ~g~Go Defend them..",2000,3);
    SetPlayerPos(playerid, -39.8148,2367.1724,23.9401);
    return 1;
}
error

Код:
C:\Users\Axme\Desktop\Server\gamemodes\Hydraffs.pwn(672) : error 010: invalid function or declaration
C:\Users\Axme\Desktop\Server\gamemodes\Hydraffs.pwn(679) : error 010: invalid function or declaration
thx


Re: simple error - Jay. - 11.08.2011

You could of posted this on your other topic.
pawn Код:
Dday(playerid)
{  
    if(gTeam[playerid] == TEAM_YOURTEAM)
    {
    SetPlayerTeam(playerid, 0);
    SetPlayerColor(playerid, 0xFF0000FF); // Red
    SetPlayerVirtualWorld(playerid, 3);
    GameTextForPlayer(playerid,"You're ~r~Attacker. ~g~Go Attack them..",2000,3);
    SetPlayerPos(playerid, -143.5201,2462.7905,16.5642);
    }
    else
    {
    SetPlayerTeam(playerid, 1);
    SetPlayerColor(playerid, 0x00FF00FF); // Green
    SetPlayerVirtualWorld(playerid, 3);
    GameTextForPlayer(playerid,"You're ~g~Defender. ~g~Go Defend them..",2000,3);
    SetPlayerPos(playerid, -39.8148,2367.1724,23.9401);
   }
    return 1;
}
It's not a sa-mp function therefore it wants you to forward it. or create it , somehow.
I'm not really sure but just try my code.

Use Dday(playerid); to call it.

edit: maybe I was wrong, i didn't notice.
but yes where is your if statement ?
I edited my code and gave you a little example of how to use "else"


Re: simple error - Sascha - 11.08.2011

am I wrong or are you missing some a { and a }?
one if statement is missing... or since when do you use "public ...{ }else{...}"?..
pawn Код:
public Dday(playerid)
{
  //if statement?
    SetPlayerTeam(playerid, 0);
    SetPlayerColor(playerid, 0xFF0000FF); // Red
    SetPlayerVirtualWorld(playerid, 3);
    GameTextForPlayer(playerid,"You're ~r~Attacker. ~g~Go Attack them..",2000,3);
    SetPlayerPos(playerid, -143.5201,2462.7905,16.5642);
    }
    else
    {
    SetPlayerTeam(playerid, 1);
    SetPlayerColor(playerid, 0x00FF00FF); // Green
    SetPlayerVirtualWorld(playerid, 3);
    GameTextForPlayer(playerid,"You're ~g~Defender. ~g~Go Defend them..",2000,3);
    SetPlayerPos(playerid, -39.8148,2367.1724,23.9401);
//close bracket
    return 1;
}



Re: simple error - Davz*|*Criss - 11.08.2011

Aah here is my code:

pawn Код:
public Dday(playerid)
{
    if(WarJoin[playerid])
    {
       SetPlayerTeam(playerid, 0);
       SetPlayerColor(playerid, 0xFF0000FF); // Red
       SetPlayerVirtualWorld(playerid, 3);
       GameTextForPlayer(playerid,"You're ~r~Attacker. ~g~Go Attack them..",2000,3);
       SetPlayerPos(playerid, -143.5201,2462.7905,16.5642);
       }
       else
       {
       SetPlayerTeam(playerid, 1);
       SetPlayerColor(playerid, 0x00FF00FF); // Green
       SetPlayerVirtualWorld(playerid, 3);
       GameTextForPlayer(playerid,"You're ~g~Defender. ~g~Go Defend them..",2000,3);
       SetPlayerPos(playerid, -39.8148,2367.1724,23.9401);
    }
    return 1;
}
Fixed already but thanks anyway lol, and anyway sorry for the second topic.

Thanks

Davz!