Random Names
#1

pawn Код:
CMD:namekick(playerid, params[])
{
    new playerb, string[128];
    new rand = random(sizeof(NamesRP));
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(PlayerInfo[playerid][pAdmin] < 1 && PlayerInfo[playerid][pMapper] < 4 && !PlayerInfo[playerid][pMod]) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");

    if(sscanf(params, "u", playerb, params)) return SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /namekick [playerid]");
    if(!IsPlayerConnected(playerb)) return SendClientMessage(playerid, COLOR_GREY, "Invalid player id.");
    if(IsPlayerNPC(playerb)) return SendClientMessage(playerid, COLOR_GREY, "You can't kick NPCs out of the server.");
    if(PlayerInfo[playerid][pAdmin] < PlayerInfo[playerb][pAdmin]) return SendClientMessage(playerid, COLOR_GREY, "Player has a higher admin level than you."); format(string, sizeof(string), "AdmCmd: %s has been kicked by %s (%s), reason: Change your name good example: %s", RPN(playerb), RPN(playerid), NamesRP);
    format(string, sizeof(string), "AdmCmd: %s has been kicked by %s (%s), reason: Change your name good example: %s", RPN(playerb), RPN(playerid), NamesRP);
    SendClientMessageToAll(COLOR_LIGHTRED, string);
    format(string, sizeof(string), "AdmCmd: %s has been kicked by %s (%s), reason: Change your name good example: %s", RPN(playerb), RPN(playerid), RPIP(playerid), NamesRP);
    Log("logs/kick.log", string);
    SetTimerEx("kickbugfix", 500, false, "i", playerb);
    return 1;
}
pawn Код:
forward NamesRP();
new NamesRP[][] =
{
    "Danny_Williams",
    "Nick_Harmold",
    "Francisca_Perrotti"
    "Hannah_Ress",
    "Mathilde_Rhynes",
    "Jarod_Otani",
    "Dallas_Poppe",
    "Russell_Secord",
    "Timmy_Taitt",
    "Shantel_Golden",
    "Lavina_Kilpatrick",
    "Janina_Drummond",
    "Stephan_Mohan",
    "Victor_Lown",
    "Chris_Tabler",
    "Hung_Pushard",
    "Jennefer_Forsyth",
    "Tyler_Mitchels"
};
Whats wrong here?

pawn Код:
C:\Users\Elitebook 8730w\Desktop\Divoro\gamemodes\d-rp.pwn(24252) : error 072: "sizeof" operator is invalid on "function" symbols
C:\Users\Elitebook 8730w\Desktop\Divoro\gamemodes\d-rp.pwn(24259) : error 076: syntax error in the expression, or invalid function call
C:\Users\Elitebook 8730w\Desktop\Divoro\gamemodes\d-rp.pwn(24260) : error 076: syntax error in the expression, or invalid function call
C:\Users\Elitebook 8730w\Desktop\Divoro\gamemodes\d-rp.pwn(24262) : error 076: syntax error in the expression, or invalid function call
C:\Users\Elitebook 8730w\Desktop\Divoro\gamemodes\d-rp.pwn(24252) : warning 204: symbol is assigned a value that is never used: "rand"
C:\Users\Elitebook 8730w\Desktop\Divoro\gamemodes\d-rp.pwn(36362) : error 001: expected token: ";", but found "-string-"
C:\Users\Elitebook 8730w\Desktop\Divoro\gamemodes\d-rp.pwn(36377) : error 010: invalid function or declaration
C:\Users\Elitebook 8730w\Desktop\Divoro\gamemodes\d-rp.pwn(36378) : warning 203: symbol is never used: "NamesRP"
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


6 Errors.
Reply
#2

This is wrong.
You don't need to declare arrays in such manner.

pawn Код:
forward NamesRP();
Just remove it.
Reply
#3

Quote:
Originally Posted by Abagail
Посмотреть сообщение
This is wrong.
You don't need to declare arrays in such manner.

pawn Код:
forward NamesRP();
Just remove it.
pawn Код:
C:\Users\Elitebook 8730w\Desktop\Divoro\gamemodes\d-rp.pwn(24252) : error 017: undefined symbol "NamesRP"
C:\Users\Elitebook 8730w\Desktop\Divoro\gamemodes\d-rp.pwn(24252) : error 029: invalid expression, assumed zero
C:\Users\Elitebook 8730w\Desktop\Divoro\gamemodes\d-rp.pwn(24252) : warning 215: expression has no effect
C:\Users\Elitebook 8730w\Desktop\Divoro\gamemodes\d-rp.pwn(24259) : error 017: undefined symbol "NamesRP"
C:\Users\Elitebook 8730w\Desktop\Divoro\gamemodes\d-rp.pwn(24260) : error 017: undefined symbol "NamesRP"
C:\Users\Elitebook 8730w\Desktop\Divoro\gamemodes\d-rp.pwn(24262) : error 017: undefined symbol "NamesRP"
C:\Users\Elitebook 8730w\Desktop\Divoro\gamemodes\d-rp.pwn(24252) : warning 204: symbol is assigned a value that is never used: "rand"
C:\Users\Elitebook 8730w\Desktop\Divoro\gamemodes\d-rp.pwn(36362) : error 001: expected token: "}", but found "-string-"
C:\Users\Elitebook 8730w\Desktop\Divoro\gamemodes\d-rp.pwn(36377) : error 010: invalid function or declaration
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


7 Errors.
Reply
#4

Код:
if(sscanf(params, "u", playerb, params))
Reply
#5

Quote:
Originally Posted by Dutheil
Посмотреть сообщение
Код:
if(sscanf(params, "u", playerb, params))
What do you mean with that? do i need to remove it if it is a yes,

pawn Код:
C:\Users\Elitebook 8730w\Desktop\Divoro\gamemodes\d-rp.pwn(24252) : error 017: undefined symbol "NamesRP"
C:\Users\Elitebook 8730w\Desktop\Divoro\gamemodes\d-rp.pwn(24252) : error 029: invalid expression, assumed zero
C:\Users\Elitebook 8730w\Desktop\Divoro\gamemodes\d-rp.pwn(24252) : warning 215: expression has no effect
C:\Users\Elitebook 8730w\Desktop\Divoro\gamemodes\d-rp.pwn(24259) : error 017: undefined symbol "NamesRP"
C:\Users\Elitebook 8730w\Desktop\Divoro\gamemodes\d-rp.pwn(24260) : error 017: undefined symbol "NamesRP"
C:\Users\Elitebook 8730w\Desktop\Divoro\gamemodes\d-rp.pwn(24262) : error 017: undefined symbol "NamesRP"
C:\Users\Elitebook 8730w\Desktop\Divoro\gamemodes\d-rp.pwn(24252) : warning 204: symbol is assigned a value that is never used: "rand"
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


5 Errors.
Reply
#6

pawn Код:
new NamesRP[][] =
{
    "Danny_Williams",
    "Nick_Harmold",
    "Francisca_Perrotti"
    "Hannah_Ress",
    "Mathilde_Rhynes",
    "Jarod_Otani",
    "Dallas_Poppe",
    "Russell_Secord",
    "Timmy_Taitt",
    "Shantel_Golden",
    "Lavina_Kilpatrick",
    "Janina_Drummond",
    "Stephan_Mohan",
    "Victor_Lown",
    "Chris_Tabler",
    "Hung_Pushard",
    "Jennefer_Forsyth",
    "Tyler_Mitchels"
};

CMD:namekick(playerid, params[])
{
    new playerb;
    if(!IsPlayerLoggedIn(playerid)) SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    else if(PlayerInfo[playerid][pAdmin] < 1 && PlayerInfo[playerid][pMapper] < 4 && !PlayerInfo[playerid][pMod]) SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
    else if(sscanf(params, "u", playerb)) SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /namekick [playerid]");
    else if(!IsPlayerConnected(playerb)) SendClientMessage(playerid, COLOR_GREY, "Invalid player id.");
    else if(IsPlayerNPC(playerb)) SendClientMessage(playerid, COLOR_GREY, "You can't kick NPCs out of the server.");
    else if(PlayerInfo[playerid][pAdmin] < PlayerInfo[playerb][pAdmin]) SendClientMessage(playerid, COLOR_GREY, "Player has a higher admin level than you.");
    else{
        new string[145],rand = random(sizeof(NamesRP));
        format(string, sizeof(string), "AdmCmd: %s has been kicked by %s (%s), reason: Change your name good example: %s", RPN(playerb), RPN(playerid), RPIP(playerid), NamesRP[rand]);
        SendClientMessageToAll(COLOR_LIGHTRED, string);
        Log("logs/kick.log", string);
        SetTimerEx("kickbugfix", 500, false, "i", playerb);
    }
    return 1;
}
Reply
#7

Quote:
Originally Posted by Jefff
Посмотреть сообщение
pawn Код:
new NamesRP[][] =
{
    "Danny_Williams",
    "Nick_Harmold",
    "Francisca_Perrotti"
    "Hannah_Ress",
    "Mathilde_Rhynes",
    "Jarod_Otani",
    "Dallas_Poppe",
    "Russell_Secord",
    "Timmy_Taitt",
    "Shantel_Golden",
    "Lavina_Kilpatrick",
    "Janina_Drummond",
    "Stephan_Mohan",
    "Victor_Lown",
    "Chris_Tabler",
    "Hung_Pushard",
    "Jennefer_Forsyth",
    "Tyler_Mitchels"
};

CMD:namekick(playerid, params[])
{
    new playerb;
    if(!IsPlayerLoggedIn(playerid)) SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    else if(PlayerInfo[playerid][pAdmin] < 1 && PlayerInfo[playerid][pMapper] < 4 && !PlayerInfo[playerid][pMod]) SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
    else if(sscanf(params, "u", playerb)) SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /namekick [playerid]");
    else if(!IsPlayerConnected(playerb)) SendClientMessage(playerid, COLOR_GREY, "Invalid player id.");
    else if(IsPlayerNPC(playerb)) SendClientMessage(playerid, COLOR_GREY, "You can't kick NPCs out of the server.");
    else if(PlayerInfo[playerid][pAdmin] < PlayerInfo[playerb][pAdmin]) SendClientMessage(playerid, COLOR_GREY, "Player has a higher admin level than you.");
    else{
        new string[145],rand = random(sizeof(NamesRP));
        format(string, sizeof(string), "AdmCmd: %s has been kicked by %s (%s), reason: Change your name good example: %s", RPN(playerb), RPN(playerid), RPIP(playerid), NamesRP[rand]);
        SendClientMessageToAll(COLOR_LIGHTRED, string);
        Log("logs/kick.log", string);
        SetTimerEx("kickbugfix", 500, false, "i", playerb);
    }
    return 1;
}
No errors let me check if it works
Reply
#8

You forgot a comma (,) after the 3rd name: "Francisca_Perrotti"
Reply
#9

If you're only going to use that list once, it'd probably be better to declare it as a static const within the command itself.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)