1 Error 2 Warns
#1

PHP код:
C:\Users\WeeD\Desktop\LSC-RP\gamemodes\LSC-RP.pwn(18093) : warning 225unreachable code
C
:\Users\WeeD\Desktop\LSC-RP\gamemodes\LSC-RP.pwn(18162) : warning 225unreachable code
C
:\Users\WeeD\Desktop\LSC-RP\gamemodes\LSC-RP.pwn(18162) : error 017undefined symbol "f"
Pawn compiler 3.2.3664              Copyright (c1997-2006ITB CompuPhase 
PHP код:

18093    
if(sscanf(params"s[24]"text)) return SendClientMessage(playeridCOLOR_WHITE"[Usage]: /aname [name]");
18162    if(f
I dunno how to fix these :/ I want to get the server up and running but these are the left ones which are cousing problems ;/
Reply
#2

Show us the whole code.
Reply
#3

More info of the situation.

Whole server script here. http://paste2.org/d1adZ3cB

PHP код:
CMD:aname(playeridparams[])
{
    new 
string[128], file[32], text[MAX_PLAYER_NAME];
       if(!
IsPlayerLoggedIn(playerid)) return SendClientMessage(playeridCOLOR_GREY"You need to login first before using any command.");
    return 
SendClientMessage(playeridCOLOR_GREY"You are not authorized to use this command.");
18093    if(sscanf(params"s[24]"text)) return SendClientMessage(playeridCOLOR_WHITE"[Usage]: /aname [name]");
    if(
aDuty[playerid]) return SendClientMessage(playeridCOLOR_GREY"You must be off duty to change your admin name.");
    if(
strlen(text) < 2) return SendClientMessage(playeridCOLOR_GREY"The admin name needs to be atleast 2 characters.");
    
// Start of detecting space in name
    
new endtemp[32], temp2[32];
    
end strfind(text" ",true);
    if(
end != -1)
    {
        
strmid(temptext0end);
        
format(tempsizeof(temp), "%s_"temp);
        
strdel(text0end);
        
strmid(temp2text1strlen(text));
        
format(text24"");
        
strcat(texttempsizeof(temp));
        
strcat(texttemp2sizeof(temp2));
    }
    
// End of detecting space in name
    
format(filesizeof(file), "users/%s.ini"text);
    if(
dini_Exists(file))
    {
        
format(filesizeof(file), "users/%s.ini"RPNU(playerid));
        if(
strlen(dini_Get(file"AdminName")) && strcmp(dini_Get(file"AdminName"), text))
        {
             
SendClientMessage(playeridCOLOR_GREY"Name is already in use.");
            return 
1;
        }
    }
    
format(stringsizeof(string), " You have changed your admin name to: {FF6347}%s"text);
    
SendClientMessage(playeridCOLOR_WHITEstring);
    
format(stringsizeof(string), "%s has changed their admin name to %s."RPN(playerid), text);
    
Log("logs/aname.log"string);
    
format(filesizeof(file), "users/%s.ini"RPNU(playerid));
    
format(filesizeof(file), "users/%s.ini"dini_Get(file"AdminName"));
    if(
dini_Exists(file)) dini_Remove(file);
    
format(filesizeof(file), "users/%s.ini"RPNU(playerid));
    
dini_Set(file"AdminName"text);
    
format(filesizeof(file), "users/%s.ini",dini_Get(file"AdminName"));
    
dini_Create(file);
    
dini_Set(file"OldName"RPNU(playerid));
    
dini_IntSet(file"Admin"PlayerInfo[playerid][pAdmin]);
    
dini_IntSet(file"AdminAccount"1);
    
dini_IntSet(file"Age"25);
    
dini_IntSet(file"Gender"1);
    
dini_IntSet(file"Tutorial"1);
    
dini_Set(file"IP"PlayerInfo[playerid][pIP]);
    return 
1;

PHP код:
CMD:aduty(playeridparams[])
{
    new 
string[128], file[32];
       if(!
IsPlayerLoggedIn(playerid)) return SendClientMessage(playeridCOLOR_GREY"You need to login first before using any command.");
    return 
SendClientMessage(playeridCOLOR_GREY"You are not authorized to use this command.");
18162    if(f)
    {
        
format(filesizeof(file), "users/%s.ini"RPNU(playerid));
        
format(filesizeof(file), "users/%s.ini"dini_Get(file"AdminName"));
        if(!
dini_Exists(file)) return SendClientMessage(playeridCOLOR_GREY"Choose an admin name using /aname first.");
        
format(filesizeof(file), "users/%s.ini"RPNU(playerid));
        
format(stringsizeof(string), "AdmWarn: %s has went on admin duty. (Admin name: %s)"RPN(playerid), dini_Get(file"AdminName"));
        
SendAdminMessage(COLOR_DARKRED1string);
        
SaveChar(playerid);
        
ClearChar(playerid);
        
format(filesizeof(file), "users/%s.ini"RPNU(playerid));
        
SetPlayerName(playeriddini_Get(file"AdminName"));
        
LoadChar(playerid);
        
aDuty[playerid] = 1;
        
SpawnChar(playerid);
        
GetPlayerIp(playeridPlayerInfo[playerid][pIP], 16);
        
format(stringsizeof(string), "%s"RPALN(playerid));
        if(
IsValidDynamic3DTextLabel(aDutyText[playerid]))  DestroyDynamic3DTextLabel(aDutyText[playerid]);
        if(
PlayerInfo[playerid][pAdmin] == 1aDutyText[playerid] = CreateDynamic3DTextLabel(stringCOLOR_LIGHTGREEN00, -2025playerid);
        if(
PlayerInfo[playerid][pAdmin] == 2aDutyText[playerid] = CreateDynamic3DTextLabel(stringCOLOR_LIME00, -2025playerid);
        if(
PlayerInfo[playerid][pAdmin] == 3aDutyText[playerid] = CreateDynamic3DTextLabel(stringCOLOR_YELLOW00, -2025playerid);
        if(
PlayerInfo[playerid][pAdmin] == 4aDutyText[playerid] = CreateDynamic3DTextLabel(stringCOLOR_ORANGE00, -2025playerid);
        if(
PlayerInfo[playerid][pAdmin] == 5aDutyText[playerid] = CreateDynamic3DTextLabel(stringCOLOR_RED00, -2025playerid);
        if(
PlayerInfo[playerid][pAdmin] == 6aDutyText[playerid] = CreateDynamic3DTextLabel(stringCOLOR_DARKRED00, -2025playerid);
        if(
PlayerInfo[playerid][pAdmin] == 7aDutyText[playerid] = CreateDynamic3DTextLabel(stringCOLOR_DARKRED00, -2025playerid);
        
Streamer_SetFloatData(STREAMER_TYPE_3D_TEXT_LABELaDutyText[playerid] , E_STREAMER_ATTACH_OFFSET_Z0.25);
    }
    else
    {
        if(
Spec[playerid]) return SendClientMessage(playeridCOLOR_GREY"You can't go off admin duty while spectating someone.");
        
format(filesizeof(file), "users/%s.ini",RPNU(playerid));
        
SaveChar(playerid);
        
ClearChar(playerid);
        
SetPlayerName(playeriddini_Get(file"OldName"));
        
LoadChar(playerid);
        
aDuty[playerid] = 0;
        
SpawnChar(playerid);
        
format(filesizeof(file), "users/%s.ini"RPNU(playerid));
        
format(stringsizeof(string), "AdmWarn: %s has went off admin duty. (Admin name: %s)"RPN(playerid), dini_Get(file"AdminName"));
        
SendAdminMessage(COLOR_DARKRED1string);
        
DestroyDynamic3DTextLabel(aDutyText[playerid]);
    }
    return 
1;

Reply
#4

Bump. I rly need help on this.
Reply
#5

Try to add a semicolon ";" in,
Код:
if(sscanf(params, "s[24]", text)) return SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /aname [name]")
For Example,
Код:
if(sscanf(params, "s[24]", text)) return SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /aname [name]");
Reply
#6

Quote:
Originally Posted by SAMProductions
Посмотреть сообщение
Try to add a semicolon ";" in,
Код:
if(sscanf(params, "s[24]", text)) return SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /aname [name]")
For Example,
Код:
if(sscanf(params, "s[24]", text)) return SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /aname [name]");
EDIT: The poster above already gave the answer.
Reply
#7

Your "unreachable code" warning is because you have returned something under if(..)
Reply
#8

Quote:
Originally Posted by Marsss
Посмотреть сообщение
#Define f

REP Me please
This will only hide the warning and bug the code!
Reply
#9

Quote:
Originally Posted by Stinged
Посмотреть сообщение
This will only hide the warning and bug the code!
Yeah i know that thats the reason why i didnt #define it.

Is there a way how to fix it ?
Reply
#10

Quote:
Originally Posted by SAMProductions
Посмотреть сообщение
Try to add a semicolon ";" in,
Код:
if(sscanf(params, "s[24]", text)) return SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /aname [name]")
For Example,
Код:
if(sscanf(params, "s[24]", text)) return SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /aname [name]");
Thanks for your help
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)