Error 017 : Undefined symbol ''params''
#1

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{

if(!strcmp(cmdtext, "/makeadmin", true))
{
    new player[MAX_PLAYER_NAME], giveplayer[MAX_PLAYER_NAME], level, giveplayerid, string[128];
    if(IsPlayerAdmin(playerid))
    {
        if(!sscanf(params,"ud",giveplayer,level))
        {
            if(giveplayerid != INVALID_PLAYER_ID)
            {
                GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                GetPlayerName(playerid, player, sizeof(player));
                PlayerInfo[giveplayerid][AdminLvl] = level;
                printf("Admin %s made %s a level %d admin.", player, giveplayer, level);
                format(string, sizeof(string), "You are now an administrator level %d thanks to %s.", level,  player);
                SendClientMessage(giveplayerid, 0x00C2ECFF, string);
                format(string, sizeof(string), "You have given %s level %d admin.",  giveplayer,PlayerInfo[giveplayerid][AdminLvl]);
                SendClientMessage(playerid, 0x00C2ECFF, string);
            }
            else
            {
                format(string, sizeof(string), "%i is not an active player.", giveplayerid);
                SendClientMessage(playerid, 0xE60000FF, string);
                return 1;
            }
        }
        else
        {
            SendClientMessage(playerid, Crvena, "USAGE: /makeadmin [playerid] [level]");
            SendClientMessage(playerid, Crvena, "FUNCTION: Player will be an admin.");
            return 1;
        }
    }
    else SendClientMessage(playerid, 0xE60000FF, "You are not a lead admin!");
    return 1;
}

return SendClientMesage(playerid, 0xFF9900AA, "Command does not exist use /help");
}
Thats my command.

Код:
error 017: undefined symbol "params"
Help.
Reply
#2

Well the problem is exactly what it says, there is no params variable in that scope!

pawn Код:
if(!sscanf(params,"ud",giveplayer,level))
So instead, you could try:

pawn Код:
if(!sscanf(cmdtext,"ud",giveplayer,level))
Reply
#3

I really don't know what to do :@@@@@ When I put that command in my GameMode, my Login Dialog won't work ! I just click SPAWN, and type /makeadmin, and SERVER:Unknown Command pops out ! :@
Reply
#4

Um Why not just make it Sscanf command
and at top of gamemode put
include <sscanf>
and in onplayercommandtext

Put this at the top or bottom before return 1;
dcmd(makeadmin, 9 ,cmdtext);



and replace if(!strcmp(cmdtext, "/makeadmin", true))
with this but make sure that this command is in its own column
dcmd_makeadmin(playerid, params[]) {
Reply
#5

Well, I'm so pissed off, I'm trying to make this work for three days now !

Here's my wholle GM !

It's small ( I'm a beginner trying to make a new GM )

I put it in pastebin... Link : http://pastebin.com/tYxVBy3d


PLEASE help me, I don't know what to do :S
Reply
#6

Quote:
Originally Posted by JaTochNietDan
Посмотреть сообщение
Well the problem is exactly what it says, there is no params variable in that scope!

pawn Код:
if(!sscanf(params,"ud",giveplayer,level))
So instead, you could try:

pawn Код:
if(!sscanf(cmdtext,"ud",giveplayer,level))
To the OP.. This way that JaToch said works, I just tested it and worked perfectly. The only warnings i got were for stuff you defined for OnPlayerDialogResponse which i removed because you never finished it.. But yeah, replace the "params" to "cmdtext" and voila..
Reply
#7

pawn Код:
/* Try this: */ sscanf(cmdtext, "p< >s[32]ui", cmdtext, giveplayer, level)
Reply
#8

yea... I tried what you said, Luka...

This is what my command looks like now :

Quote:

dcmd_makeadmin(playerid, params[]) {

new player[MAX_PLAYER_NAME], giveplayer[MAX_PLAYER_NAME], level, giveplayerid, string[128];
if(IsPlayerAdmin(playerid))
{
if (sscanf(params, "p< >s[32]ui", params, giveplayer, level))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, player, sizeof(player));
PlayerInfo[giveplayerid][AdminLvl] = level;
printf("Admin %s made %s a level %d admin.", player, giveplayer, level);
format(string, sizeof(string), "You are now an administrator level %d thanks to %s.", level, player);
SendClientMessage(giveplayerid, 0x00C2ECFF, string);
format(string, sizeof(string), "You have given %s level %d admin.", giveplayer,PlayerInfo[giveplayerid][AdminLvl]);
SendClientMessage(playerid, 0x00C2ECFF, string);
}
else
{
format(string, sizeof(string), "%i is not an active player.", giveplayerid);
SendClientMessage(playerid, 0xE60000FF, string);
return 1;
}
}
else
{
SendClientMessage(playerid, Crvena, "USAGE: /makeadmin [playerid] [level]");
SendClientMessage(playerid, Crvena, "FUNCTION: Player will be an admin.");
return 1;
}
}
else SendClientMessage(playerid, 0xE60000FF, "You are not a lead admin!");
return 1;
}

But, I won't bother you any more. I'm quiting the scripting -.- For those of you that say I didn't try hard enough, I definatly did. For more than 5 days, I'm working on this command -.-' Whatever and however I do it, either it doesn't work, or my login dialog gets messed up... I opened 3 topics with the same question, but no1 seems to understand what I did wrong... Guys that tried to help me, thanks.
Reply
#9

pawn Код:
dcmd_makeadmin(playerid, params[])
{
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xE60000FF, "You are not a lead admin!");
    new player[MAX_PLAYER_NAME], giveplayer[MAX_PLAYER_NAME], level, giveplayerid, string[128];
    if (sscanf(params, "ui", giveplayerid, level))
    {
        SendClientMessage(playerid, Crvena, "USAGE: /makeadmin [playerid] [level]");
        SendClientMessage(playerid, Crvena, "FUNCTION: Player will be an admin.");
        return 1;
    }
    if(!IsPlayerConnected(giveplayerid))
    {
        format(string, sizeof(string), "%i is not an active player.", giveplayerid);
        SendClientMessage(playerid, 0xE60000FF, string);
        return 1;
    }
    GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
    GetPlayerName(playerid, player, sizeof(player));
    PlayerInfo[giveplayerid][AdminLvl] = level;
    printf("Admin %s made %s a level %d admin.", player, giveplayer, level);
    format(string, sizeof(string), "You are now an administrator level %d thanks to %s.", level, player);
    SendClientMessage(giveplayerid, 0x00C2ECFF, string);
    format(string, sizeof(string), "You have given %s level %d admin.", giveplayer,PlayerInfo[giveplayerid][AdminLvl]);
    SendClientMessage(playerid, 0x00C2ECFF, string);
    return 1;
}
Reply
#10

Quote:
Originally Posted by .sparkY
Посмотреть сообщение
yea... I tried what you said, Luka...

This is what my command looks like now :



But, I won't bother you any more. I'm quiting the scripting -.- For those of you that say I didn't try hard enough, I definatly did. For more than 5 days, I'm working on this command -.-' Whatever and however I do it, either it doesn't work, or my login dialog gets messed up... I opened 3 topics with the same question, but no1 seems to understand what I did wrong... Guys that tried to help me, thanks.
My god. So your just going to quit scripting when the doing gets hard?
Whats the point in even attempting to become a scripter if you're just going to do that

Here, i done what JaToch said and i get no errors. Re-Do your OnPlayeDialogresponse callback because i removed it, you never finished it.

http://pastebin.com/9EngKwAu
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)