SA-MP Forums Archive
error 017: undefined symbol "dcmd" - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: error 017: undefined symbol "dcmd" (/showthread.php?tid=182099)



error 017: undefined symbol "dcmd" - Crayon - 09.10.2010

Hey guys,

Have a few problems with my register command under OnPlayerCOmmandText

Script:

pawn Код:
new params[128]; // Line 256
dcmd(register, 8, cmdtext);
dcmd(login, 5, cmdtext);

{
    dcmd_register(playerid, params[])
    {
    new file[128], pname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pname, sizeof(pname));
    format(file, sizeof(file), "\\Users\\%s.ini", pname);
    if(!strlen(params)) return SendClientMessage(playerid, COLOR_DORANGE, "[USAGE]: /register [PASSWORD]");
    if(dini_Exists(file)) return SendClientMessage(playerid, COLOR_DORANGE, "[SYSTEM]: This account is already registered in our database!");
    dini_Create(file);
    dini_IntSet(file, "hashPW", udb_hash(params));
    dini_Set(file, "password", params);
    dini_IntSet(file, "AdminLevel",PlayerInfo[playerid][AdminLevel] = 0);
    dini_IntSet(file, "score", PlayerInfo[playerid][score] = 0);
    dini_IntSet(file, "money", PlayerInfo[playerid][cash] = 500);
    new string[128];
    format(string, 128, "[SYSTEM]: You succesfully registered the nickname %s with password %s", pname, params);
    SendClientMessage(playerid, COLOR_YELLOW, string);
    logged[playerid] = 1;
    SendClientMessage(playerid, COLOR_YELLOW, "[SYSTEM]: You have been automatically logged in!");

    return 1;

    }
}
errors:


C:\Users\Ali\Desktop\SAMP Server\gamemodes\untitled.pwn(255) : warning 217: loose indentation
C:\Users\Ali\Desktop\SAMP Server\gamemodes\untitled.pwn(257) : error 017: undefined symbol "dcmd"
C:\Users\Ali\Desktop\SAMP Server\gamemodes\untitled.pwn(25 : error 017: undefined symbol "dcmd"
C:\Users\Ali\Desktop\SAMP Server\gamemodes\untitled.pwn(261) : error 017: undefined symbol "dcmd_register"

3 Errors.


Any help will be appreciated, thank you S.A.M.P members


Re: error 017: undefined symbol "dcmd" - CrucixTM - 09.10.2010

You have to do it like this:

OnPlayerCommandText: dcmd(register, 8, cmdtext)

BOTTOM OF SCRIPT(outside any other code): dcmd_register(playerid, params[])

EDIT: Also, add this line to the top of your script, right under your includes:
pawn Код:
#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1



Re: error 017: undefined symbol "dcmd" - Crayon - 09.10.2010

Edit: Sorry I actually don't understand, lol.

I deleted

dcmd(register, 8, cmdtext)
dcmd(login, 5, cmdtext)

and I came with one error now;

C:\Users\Ali\Desktop\SAMP Server\gamemodes\untitled.pwn(261) : error 017: undefined symbol "dcmd_register"


Re: error 017: undefined symbol "dcmd" - CrucixTM - 09.10.2010

No problem, just ask.


Re: error 017: undefined symbol "dcmd" - Crayon - 09.10.2010

Sorry edited my above post

I deleted

dcmd(register, 8, cmdtext)
dcmd(login, 5, cmdtext)

and I came with one error now;

C:\Users\Ali\Desktop\SAMP Server\gamemodes\untitled.pwn(261) : error 017: undefined symbol "dcmd_register"


Re: error 017: undefined symbol "dcmd" - CrucixTM - 09.10.2010

pawn Код:
// Put this define in the very top of your script right under your includes.

#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1


// Then go to OnPlayerCommandText:

public OnPlayerCommandText(playerid, cmdtext[])
{
    dcmd(register, 8, cmdtext); // Just this here.

}


// Then put the command in the bottom of the script, outside any code.

dcmd_register(playerid, params[])
{
    new file[128], pname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pname, sizeof(pname));
    format(file, sizeof(file), "\\Users\\%s.ini", pname);
    if(!strlen(params)) return SendClientMessage(playerid, COLOR_DORANGE, "[USAGE]: /register [PASSWORD]");
    if(dini_Exists(file)) return SendClientMessage(playerid, COLOR_DORANGE, "[SYSTEM]: This account is already registered in our database!");
    dini_Create(file);
    dini_IntSet(file, "hashPW", udb_hash(params));
    dini_Set(file, "password", params);
    dini_IntSet(file, "AdminLevel",PlayerInfo[playerid][AdminLevel] = 0);
    dini_IntSet(file, "score", PlayerInfo[playerid][score] = 0);
    dini_IntSet(file, "money", PlayerInfo[playerid][cash] = 500);
    new string[128];
    format(string, 128, "[SYSTEM]: You succesfully registered the nickname %s with password %s", pname, params);
    SendClientMessage(playerid, COLOR_YELLOW, string);
    logged[playerid] = 1;
    SendClientMessage(playerid, COLOR_YELLOW, "[SYSTEM]: You have been automatically logged in!");
    return 1;
}
Does this help?


Re: error 017: undefined symbol "dcmd" - Retardedwolf - 09.10.2010

@CruixTM, you forgot a }


Re: error 017: undefined symbol "dcmd" - CrucixTM - 09.10.2010

Quote:
Originally Posted by Retardedwolf
Посмотреть сообщение
@CruixTM, you forgot a }
Oooooops fixed


Re: error 017: undefined symbol "dcmd" - Crayon - 09.10.2010

Unfortunately I still get two errors now;

C:\Users\Ali\Desktop\SAMP Server\gamemodes\untitled.pwn(166) : error 017: undefined symbol "dcmd_register"
C:\Users\Ali\Desktop\SAMP Server\gamemodes\untitled.pwn(169) : warning 217: loose indentation
C:\Users\Ali\Desktop\SAMP Server\gamemodes\untitled.pwn(261) : warning 217: loose indentation
C:\Users\Ali\Desktop\SAMP Server\gamemodes\untitled.pwn(263) : error 017: undefined symbol "dcmd_register"


But I'll try solving it from here now since I don't want to waste your time. I really appreciate your help and wish I can repay you some how.


Re: error 017: undefined symbol "dcmd" - CrucixTM - 09.10.2010

Quote:
Originally Posted by Crayon
Посмотреть сообщение
Unfortunately I still get two errors now;

C:\Users\Ali\Desktop\SAMP Server\gamemodes\untitled.pwn(166) : error 017: undefined symbol "dcmd_register"
C:\Users\Ali\Desktop\SAMP Server\gamemodes\untitled.pwn(169) : warning 217: loose indentation
C:\Users\Ali\Desktop\SAMP Server\gamemodes\untitled.pwn(261) : warning 217: loose indentation
C:\Users\Ali\Desktop\SAMP Server\gamemodes\untitled.pwn(263) : error 017: undefined symbol "dcmd_register"


But I'll try solving it from here now since I don't want to waste your time. I really appreciate your help and wish I can repay you some how.
If you upload your script to pastebin and PM the link to me, I will see if I can fix it tomorrow, if you can't spot it by youself. How about that?