1 Error & 1 Warning
#1

Command with error
pawn Код:
CMD:warn(playerid, params[])
{
    new targetid, reason, string[128];
    if(sscanf(params, "uc", targetid, reason)) return SendClientMessage(playerid, -1, "USAGE: /warn [playerid] [reason]");
    if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, -1, "ERROR: Player isn't connected.");
    if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid, -1, "You're either not admin or your admin level is not high enough!");
    {
        format(string, sizeof(string), "Player %s has recieved a warning from admin %s, reason: %s", GetName(targetid), GetName(playerid), reason);
        SendClientMessageToAll(-1, string);
        PlayerInfo[targetid][pWarnings] = ++;
    }
    return 1;
}
Whole callback with warning
pawn Код:
public OnPlayerConnect(playerid)
{
    new
        name[MAX_PLAYER_NAME]; // Create variable to hold name.
    GetPlayerName(playerid, name, sizeof(name)); // Use GetPlayername to store the player with playerid's name to the variable //above. Then use that variable with your stock.
    if(RoleplayNameCheck(name))
    {
        SendClientMessage(playerid, -1, COLOR_RED"Your name is not in the Firstname_Lastname format! "COLOR_WHITE"Please correct it.");
        Kick(playerid);
    }
    return 1;
   
    if(fexist(UserPath(playerid)))
    {
        INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COLOR_WHITE"Login",""COLOR_WHITE"Type your password below to login.","Login","Quit");
    }
    else
    {
        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,""COLOR_WHITE"Registering...",""COLOR_WHITE"Type your password below to register a new account.","Register","Quit");
    }
    return 1;
}
Error & Warnıng
Код:
E:\samp03x_svr_R1-2_win32\pawno\Roleplay.pwn(734) : error 029: invalid expression, assumed zero
E:\samp03x_svr_R1-2_win32\pawno\Roleplay.pwn(1097) : warning 225: unreachable code
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Error Line
pawn Код:
PlayerInfo[targetid][pWarnings] = ++;
Warning Line
pawn Код:
if(fexist(UserPath(playerid)))
Reply
#2

Either use
pawn Код:
PlayerInfo[targetid][pWarnings]++;
Or
pawn Код:
PlayerInfo[targetid][pWarnings] += 1;
Your way is invalid.
Reply
#3

Quote:
Originally Posted by Vince
Посмотреть сообщение
Either use
pawn Код:
PlayerInfo[targetid][pWarnings]++;
Or
pawn Код:
PlayerInfo[targetid][pWarnings] += 1;
Your way is invalid.
Woahh, thanks.... Would this kind of line work though?

pawn Код:
PlayerInfo[targetid][pCocaine] ++amount;
What would be the correct way for this, or is it correct? (amount is an integer)

Also, do you have anything on the warning?
Reply
#4

Quote:
Originally Posted by ~Varrez~
Посмотреть сообщение
Woahh, thanks.... Would this kind of line work though?

pawn Код:
PlayerInfo[targetid][pCocaine] ++amount;
What would be the correct way for this, or is it correct? (amount is an integer)

Also, do you have anything on the warning?
Use this
pawn Код:
PlayerInfo[targetid][pCocaine] += amount;
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)