command help +rep
#1

pawn Код:
CMD:invite(playerid, params[])
{
    new playerb, string[128];
    if(!pData[playerid][pFacLeader]) return SendClientMessage(playerid, COLOR_GREY, "You are not a faction leader.");
    if(sscanf(params, "u", playerb)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /invite [playerid]");
    if(!IsPlayerConnected(playerb)) return SendClientMessage(playerid, COLOR_GREY, "Invalid player id.");
    if(pData[playerb][pFac]) return SendClientMessage(playerid, COLOR_GREY, "Player is already in a faction.");
    if(playerid == playerb) return SendClientMessage(playerid, COLOR_GREY, "You can't invite yourself.");
    // Inviting
    Invited[playerb] = 1;
    Inviter[playerb] = playerid;
    Faction[playerb] = pData[playerid][pFac];
    format(string, sizeof(string), " You have invited %s to join the {33AA33}%s {33CCFF}faction.", playerb, playerid);
    SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
    format(string, sizeof(string), " %s has invited you to join the {33AA33}%s {33CCFF}faction. (/accept faction) (/cancel faction)", playerid, playerid);
    SendClientMessage(playerb, COLOR_LIGHTBLUE, string);
    return 1;
}
 
COMMAND:acceptfaction(playerid, params[])
{
    new str[128];
    if(pData[playerid][Invited] == 0) return SendClientMessage(playerid, GREY, "Nobody invited you to join a gang.");
    pData[playerid][pFac] = pData[playerid][Invited];
    pData[playerid][pFacRank] = 1;
    pData[playerid][Invited] = 0;
    format(str, sizeof(str), "%s has accepted to join %s, Welcome!", GetName(playerid), pData[playerid][pFac]);
    [pData[playerid][pFac]][pMembers] += 1;
    SaveAccount(playerid)
    return 1;
}
pawn Код:
enum pinfo
{
    Password[145],
    IP[30],
    LoggedIn,
    Adminlevel,
    Money,
    Kills,
    Level,
    Deaths,
    Warnings,
    Jailed,
    Muted,
    Float:MyX,
    Float:MyY,
    Float:MyZ,
    MyInterior,
    Banned,
    LPLevel,
    Exp,
    pFac,
    pFacRank,
    pFacLeader,
    Invited,
    Inviter,
    pMembers,
};
F:\SA-MP\Server\gamemodes\w.pwn(1510) : error 028: invalid subscript (not an array or too many subscripts): "Invited"
F:\SA-MP\Server\gamemodes\w.pwn(1510) : warning 215: expression has no effect
F:\SA-MP\Server\gamemodes\w.pwn(1510) : error 001: expected token: ";", but found "]"
F:\SA-MP\Server\gamemodes\w.pwn(1510) : error 029: invalid expression, assumed zero
F:\SA-MP\Server\gamemodes\w.pwn(1510) : fatal error 107: too many error messages on one line


Can someone help me?
Reply
#2

pawn Код:
new Invited[MAX_PLAYERS];
try this, if it doesn't exist in your script yet.

also, if you want to do this with the account variables, then do this:

instead of:
pawn Код:
Invited[playerb] = 1;
do
pawn Код:
pData[playerb][Invited] = 1;
Reply
#3

pawn Код:
COMMAND:acceptfaction(playerid, params[])
{
    new str[128];
    if(pData[playerid][Invited] == 0) return SendClientMessage(playerid, GREY, "Nobody invited you to join a gang.");
    pData[playerid][pFac] = pData[playerid][Invited];
    pData[playerid][pFacRank] = 1;
    pData[playerid][Invited] = 0;
    format(str, sizeof(str), "%s has accepted to join %s, Welcome!", GetName(playerid), pData[playerid][pFac]);
    pData[playerid][pFac][pMembers] += 1;
    SaveAccount(playerid);
    return 1;
}
Код:
enum pinfo 
{ 
    Password[145], 
    IP[30], 
    LoggedIn, 
    Adminlevel, 
    Money, 
    Kills, 
    Level, 
    Deaths, 
    Warnings, 
    Jailed, 
    Muted, 
    Float:MyX, 
    Float:MyY, 
    Float:MyZ, 
    MyInterior, 
    Banned, 
    LPLevel, 
    Exp, 
    pFac, 
    pFacRank, 
    pFacLeader, 
    Invited, 
    Inviter, 
    pMembers
};
Reply
#4

i added 'new Invited[MAX_PLAYERS];' , i edit Invited[playerb] = 1; to pData[playerb][Invited] = 1; and get errors

F:\SA-MP\Server\gamemodes\w.pwn(1512) : error 032: array index out of bounds (variable "pData")
F:\SA-MP\Server\gamemodes\w.pwn(1513) : error 028: invalid subscript (not an array or too many subscripts): "Inviter"
F:\SA-MP\Server\gamemodes\w.pwn(1513) : warning 215: expression has no effect
F:\SA-MP\Server\gamemodes\w.pwn(1513) : error 001: expected token: ";", but found "]"
F:\SA-MP\Server\gamemodes\w.pwn(1513) : error 029: invalid expression, assumed zero
F:\SA-MP\Server\gamemodes\w.pwn(1513) : fatal error 107: too many error messages on one line

F:\SA-MP\Server\gamemodes\w.pwn(122) : error 021: symbol already defined: "Invited"
F:\SA-MP\Server\gamemodes\w.pwn(123) : error 021: symbol already defined: "Inviter"


pawn Код:
new Invited[MAX_PLAYERS]; //122 line
new Inviter[MAX_PLAYERS];//123 line
pawn Код:
new playerb, string[128];
    if(!pData[playerid][pFacLeader]) return SendClientMessage(playerid, COLOR_GREY, "You are not a faction leader.");
    if(sscanf(params, "u", playerb)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /invite [playerid]");
    if(!IsPlayerConnected(playerb)) return SendClientMessage(playerid, COLOR_GREY, "Invalid player id.");
    if(pData[playerb][pFac]) return SendClientMessage(playerid, COLOR_GREY, "Player is already in a faction.");
    if(playerid == playerb) return SendClientMessage(playerid, COLOR_GREY, "You can't invite yourself.");
    // Inviting
    pData[playerb][Invited] = 1; //1512 LINE
    Inviter[playerb] = playerid; //1513 LINE
    Faction[playerb] = pData[playerid][pFac];
    format(string, sizeof(string), " You have invited %s to join the {33AA33}%s {33CCFF}faction.", playerb, playerid);
    SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
    format(string, sizeof(string), " %s has invited you to join the {33AA33}%s {33CCFF}faction. (/accept faction) (/cancel faction)", playerid, playerid);
    SendClientMessage(playerb, COLOR_LIGHTBLUE, string);
    return 1;
Reply
#5

aah, wait, i get it now..
I think you can't use 2 the same variables, which means, if you have Invited in a Enum, you can't use it again with 'new'.
What i suggest, is that you delete the 'new invited[MAX_PLAYERS];' , and leave the rest like it is.
With the rest i mean pData[playerb][Invited ].
for the inviter error, delete the 'new Inviter[MAX_PLAYERS];' and replace Inviter[playerb] with pData[Inviter][playerb]
Reply
#6

okey thats okey now.. but i get other errors and 1 strange warning ;d

pawn Код:
F:\SA-MP\Server\gamemodes\w.pwn(1512) : warning 213: tag mismatch
F:\SA-MP\Server\gamemodes\w.pwn(1528) : error 017: undefined symbol "GetName"
F:\SA-MP\Server\gamemodes\w.pwn(1529) : warning 215: expression has no effect
F:\SA-MP\Server\gamemodes\w.pwn(1529) : error 001: expected token: ";", but found "["
F:\SA-MP\Server\gamemodes\w.pwn(1529) : error 029: invalid expression, assumed zero
F:\SA-MP\Server\gamemodes\w.pwn(1529) : warning 215: expression has no effect
F:\SA-MP\Server\gamemodes\w.pwn(1529) : error 001: expected token: ";", but found "]"
F:\SA-MP\Server\gamemodes\w.pwn(1529) : fatal error 107: too many error messages on one line
pawn Код:
new playerb, string[128];
    if(!pData[playerid][pFacLeader]) return SendClientMessage(playerid, COLOR_GREY, "You are not a faction leader.");
    if(sscanf(params, "u", playerb)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /invite [playerid]");
    if(!IsPlayerConnected(playerb)) return SendClientMessage(playerid, COLOR_GREY, "Invalid player id.");
    if(pData[playerb][pFac]) return SendClientMessage(playerid, COLOR_GREY, "Player is already in a faction.");
    if(playerid == playerb) return SendClientMessage(playerid, COLOR_GREY, "You can't invite yourself.");
    // Inviting
    pData[playerb][Invited] = 1;
    pData[Inviter][playerb] = playerid; //1512 LINE
    Faction[playerb] = pData[playerid][pFac];
    format(string, sizeof(string), " You have invited %s to join the {33AA33}%s {33CCFF}faction.", playerb, playerid);
    SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
    format(string, sizeof(string), " %s has invited you to join the {33AA33}%s {33CCFF}faction. (/accept faction) (/cancel faction)", playerid, playerid);
    SendClientMessage(playerb, COLOR_LIGHTBLUE, string);
    return 1;
pawn Код:
COMMAND:acceptfaction(playerid, params[])
{
    new str[128];
    if(pData[playerid][Invited] == 0) return SendClientMessage(playerid, GREY, "Nobody invited you to join a gang.");
    pData[playerid][pFac] = pData[playerid][Invited];
    pData[playerid][pFacRank] = 1;
    pData[playerid][Invited] = 0;
    format(str, sizeof(str), "%s has accepted to join %s, Welcome!", GetName(playerid), pData[playerid][pFac]); //1528 line
    pData[playerid][pFac][pMembers] += 1; //1529 line
    SaveAccount(playerid);
    return 1;
}
Reply
#7

Код:
COMMAND:acceptfaction(playerid, params[]) 
{ 
    new str[128]; 
    if(pData[playerid][Invited] == 0) return SendClientMessage(playerid, GREY, "Nobody invited you to join a gang."); 
    pData[playerid][pFac] = pData[playerid][Invited]; 
    pData[playerid][pFacRank] = 1; 
    pData[playerid][Invited] = 0; 
    format(str, sizeof(str), "%s has accepted to join %s, Welcome!", GetName(playerid), pData[playerid][pFac]); //1528 line
    pData[playerid][pFac][pMembers]++;
    SaveAccount(playerid);
    return 1; 
}
Tried this?

And you have to remove that , after pMembers in enums.
Код:
    Inviter,
    pMembers,
};
to

Код:
    Inviter,
    pMembers
};
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)