SA-MP Forums Archive
Some errors[Giving REP] - 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: Some errors[Giving REP] (/showthread.php?tid=319015)



Some errors[Giving REP] - Guitar - 17.02.2012

Hello,

Can you help me fixing this command:

pawn Код:
CMD:tc(playerid,params[])
{
     new str[128],message[100],Nam[MAX_PLAYER_NAME];
     if(sscanf(params,"%s[100]",message)) return SendClientMessage(playerid,-1,"USAGE: /teamchat [text]");
     GetPlayerName(playerid,Nam,sizeof(Nam));
     format(str,sizeof(str),"[TEAM CHAT] %s: %s",Nam,message);
     for(new i = 0; i < MAX_PLAYERS; i++)
     {
     if(PlayerInfo[playerid][pTeam] == TEAM_DRIFT);
     {
        SendClientMessage(i, COLOR_BLUE, str);
     }
     else if(PlayerInfo[playerid][pTeam] == TEAM_DRIFT2);
     {
        SendClientMessage(i, COLOR_BLUE, str);
     }
     else if(PlayerInfo[playerid][pTeam] == TEAM_DRIFT3);
     {
        SendClientMessage(i, COLOR_BLUE, str);
     }
     else if(PlayerInfo[playerid][pTeam] == TEAM_DRIFT4);
     {
        SendClientMessage(i, COLOR_BLUE, str);
     }
     else if(PlayerInfo[playerid][pTeam] == TEAM_DRIFT5);
     {
        SendClientMessage(i, COLOR_BLUE, str);
     }
     }
     return 1;
}
Here are the warnings:

pawn Код:
C:\Documents and Settings\Administrator\My Documents\Downloads\3hab\gamemodes\DriftGM1.pwn(2313) : error 036: empty statement
C:\Documents and Settings\Administrator\My Documents\Downloads\3hab\gamemodes\DriftGM1.pwn(2317) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Administrator\My Documents\Downloads\3hab\gamemodes\DriftGM1.pwn(2317) : warning 215: expression has no effect
C:\Documents and Settings\Administrator\My Documents\Downloads\3hab\gamemodes\DriftGM1.pwn(2317) : error 001: expected token: ";", but found "if"
C:\Documents and Settings\Administrator\My Documents\Downloads\3hab\gamemodes\DriftGM1.pwn(2317) : error 036: empty statement
C:\Documents and Settings\Administrator\My Documents\Downloads\3hab\gamemodes\DriftGM1.pwn(2317) : fatal error 107: too many error messages on one line

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


5 Errors.



Re: Some errors[Giving REP] - Guitar - 17.02.2012

Bump.


Re: Some errors[Giving REP] - thimo - 17.02.2012

Wich line is it?


Re: Some errors[Giving REP] - Guitar - 17.02.2012

pawn Код:
else if(PlayerInfo[playerid][pTeam] == TEAM_DRIFT2);
That, Hm I appreciate if you reformat the whole command for me :3.


Re: Some errors[Giving REP] - Toreno - 17.02.2012

You have ";" symbol on each line of "if" or "else if", delete that symbol.
pawn Код:
CMD:tc(playerid,params[])
{
     new str[128],message[100],Nam[MAX_PLAYER_NAME];
     if(sscanf(params,"%s[100]",message)) return SendClientMessage(playerid,-1,"USAGE: /teamchat [text]");
     GetPlayerName(playerid,Nam,sizeof(Nam));
     format(str,sizeof(str),"[TEAM CHAT] %s: %s",Nam,message);
     for(new i = 0; i < MAX_PLAYERS; i++)
     {
     if(PlayerInfo[playerid][pTeam] == TEAM_DRIFT); // DELETE that SYMBOL ;
     {
        SendClientMessage(i, COLOR_BLUE, str);
     }
     else if(PlayerInfo[playerid][pTeam] == TEAM_DRIFT2); // DELETE that SYMBOL ;
     {
        SendClientMessage(i, COLOR_BLUE, str);
     }
     else if(PlayerInfo[playerid][pTeam] == TEAM_DRIFT3); // DELETE that SYMBOL ;
     {
        SendClientMessage(i, COLOR_BLUE, str);
     }
     else if(PlayerInfo[playerid][pTeam] == TEAM_DRIFT4); // DELETE that SYMBOL ;
     {
        SendClientMessage(i, COLOR_BLUE, str);
     }
     else if(PlayerInfo[playerid][pTeam] == TEAM_DRIFT5); // DELETE that SYMBOL ;
     {
        SendClientMessage(i, COLOR_BLUE, str);
     }
     }
     return 1;
}
EDIT: Your code is written wrong, in case you want me to fix it, let me know.


Re: Some errors[Giving REP] - Zarky - 17.02.2012

You Kept ; Symbol After Every 'If' and 'else if' Remove the Symbol


Re: Some errors[Giving REP] - Guitar - 17.02.2012

@Toreno, Thanks a lot man! bad me ^^