Family Info
#1

So i am creating family info command, so admins can check each family info, but i got some errors.

PHP код:
C:\Users\Euronics Latvija\Desktop\LCRP\gamemodes\nlrp.pwn(106395) : error 021symbol already defined"string"
C:\Users\Euronics Latvija\Desktop\LCRP\gamemodes\nlrp.pwn(106392) : warning 204symbol is assigned a value that is never used"string" 
My command:
PHP код:
    CMD:afstats(playeridparams[])
    {
        if(!(
PlayerInfo[playerid][pAdmin] >= || PlayerInfo[playerid][pGangModerator])) { SendClientMessage(playeridCOLOR_GREY"You are not authorized to use this command."); return 1; }
        new 
string[128], familyid;
        if(
sscanf(params"d"familyid)) { SendClientMessage(playeridCOLOR_GREY"USAGE: /afstats [family]"); return 1; }
        if(
familyid || familyid 14) return SendClientMessageEx(playeridCOLOR_WHITE"Invalid Family Number.");
        new 
familystring[128];
        
familyid -= 1;
        
format(string256"Family: %s, Money: $%d, Mats: %d, Pot: %d, Crack: %d",
        
FamilyInfo[family][FamilyName], FamilyInfo[family][FamilyBank], FamilyInfo[family][FamilyMats], FamilyInfo[family][FamilyPot], FamilyInfo[family][FamilyCrack]);
        
SendClientMessage(playeridCOLOR_YELLOW2string);
        return 
1;
    } 
Reply
#2

You've defined string[128] twice so remove one of them.
Reply
#3

remove the BOTH strings, from the two lines.
and thats it.
Reply
#4

Код:
    CMD:afstats(playerid, params[]) 
    { 
        if(!(PlayerInfo[playerid][pAdmin] >= 6 || PlayerInfo[playerid][pGangModerator])) { SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command."); return 1; } 
        new string[128], familyid; // <-- here
        if(sscanf(params, "d", familyid)) { SendClientMessage(playerid, COLOR_GREY, "USAGE: /afstats [family]"); return 1; } 
        if(familyid < 1 || familyid > 14) return SendClientMessageEx(playerid, COLOR_WHITE, "Invalid Family Number."); 
        new family, string[128]; // <-- here.
        familyid -= 1; 
        format(string, 256, "Family: %s, Money: $%d, Mats: %d, Pot: %d, Crack: %d", 
        FamilyInfo[family][FamilyName], FamilyInfo[family][FamilyBank], FamilyInfo[family][FamilyMats], FamilyInfo[family][FamilyPot], FamilyInfo[family][FamilyCrack]); 
        SendClientMessage(playerid, COLOR_YELLOW2, string); 
        return 1; 
    }
You've got the same variable name for both variables, change the name of the variable (ex: string1, string2)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)