Help :D
#3

Quote:
Originally Posted by Kwarde
Посмотреть сообщение
1: Don't use DINI; switch to DJSON.
Both are made by Dracoblue. Differences between the two:

"DINI" = "DJSON"
dini_IntGet (or something like that) = djInt
dini_IntSet = djSetInt
dini_Get = dj
dini_Set = djSet
dini_FloatGet = djFloat
dini_FloatSet = djSetFloat
(etcetera).

And the only other difference is:
In OnGameModeInit or OnFilterScriptInit, you must place djson_GameModeInit();, and the same for OnGameMode/OnFilterScript-Exit: djson_GameModeExit();

So put 'djson.inc' in your 'pawno/include' folder, change #include <dini> to #include <djson> and you can use CTRL+H to change the DINI functions to the DJSON ones. If you still don't understand it, you may send your gamemode (.pwn file) to my over PM (I won't give it to other and I won't use it myself - The reason for the PM is so that others won't have it).

Also, you shouldn't use strcmp (OnPlayerCommandText), but ZCMD.

"strcmp":
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (!strcmp(cmdtext, "/help", false))
    {
        //Command stuff here
        return 1;
    }
    if (!strcmp(cmdtext, "/kill", false))
    {
        //Command stuff here
        return 1;
    }
    return 0;
}
In ZCMD, this would be:
pawn Код:
CMD:help(playerid, params[])
{
    //Command stuff here
    return 1;
}

CMD:kill(playerid, params[])
{
    //Command stuff here
    return 1;
}
ZCMD is easier to use, and faster. However, switching from strcmp to ZCMD does take more time. You should also use sscanf2 when using zcmd (which also is easier to use). Example:

PM function in ZCMD:
pawn Код:
CMD:pm(playerid, params[])
{
    new playerId, messageTxt[75], fullStr[128];
    new yourName[MAX_PLAYER_NAME], sendName[MAX_PLAYER_NAME];
    if (sscanf(params, "ds[75]", playerId, messageTxt))
        return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /pm [playerid] [message]");
    if (playerId == playerid || !IsPlayerConnected(playerId))
        return SendClientMessage(playerid, COLOR_RED, "* The user you are trying to send the message to isn't connected or is yourself!");

    GetPlayerName(playerid, yourName, MAX_PLAYER_NAME);
    GetPlayerName(playerId, sendName, MAX_PLAYER_NAME);

    format(fullStr, 128, "* PM from %s(%d): %s", yourName, playerid, messageTxt);
    SendClientMessage(yourId, COLOR_YELLOW, fullStr);
    format(fullStr, 128, "* PM sent to %s(%d): %s", sendName, playerId, messageTxt);
    SendClientMessage(playerid, COLOR_GREEN, fullStr);
    return 1;
}
That would be alot easier then using strtok and everyhting.

Kind regards,
Kwarde
P.M. send !
Reply


Messages In This Thread
Help :D - by Sp3cter - 02.09.2012, 19:12
Re: Help :D - by Kwarde - 02.09.2012, 19:31
Re: Help :D - by Sp3cter - 03.09.2012, 05:34

Forum Jump:


Users browsing this thread: 1 Guest(s)