[AJUDA] Strtok
#2

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    new idx;
    new cmd[128];
    cmd = strtok(cmdtext, idx);
    if (strcmp("/dargrana", cmdtext, true, 10) == 0 && IsPlayerAdmin(playerid))
    {
        new tmp[128], tmp2[128];
        tmp = strtok(cmdtext, idx);
        tmp2 = strtok(cmdtext, idx);
        if(!strlen(tmp))
        {
            SendClientMessage(playerid, 0xFF0000FF, "[ERRO] Use: /dargrana [ID] [Quantia]");
            return 1;
        }
        if(!strlen(tmp2))
        {
            SendClientMessage(playerid, 0xFF0000FF, "[ERRO] Use: /dargrana [ID] [Quantia]");
            return 1;
        }
        new recebedor, quantia;
        recebedor = strval(tmp);
        quantia = strval(tmp2);

        if(IsPlayerConnected(recebedor))
        {
            new string[128], string2[128], pname[MAX_PLAYER_NAME], aname[MAX_PLAYER_NAME];
            GetPlayerName(recebedor, pname, MAX_PLAYER_NAME);
            GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
            format(string, 128, "O Admin %s deu R$%d para vocк!", aname, quantia);
            format(string2, 128, "Vocк enviou R$%d para o jogador %s", pname, quantia);
            SendClientMessage(playerid, 0xFFFF00FF, string2);
            SendClientMessage(recebedor, 0xFFFF00FF, string);
            GivePlayerMoney(recebedor, quantia);
            return 1;
        }
        else
        {
            SendClientMessage(playerid, 0xFF0000FF, "[ERRO] Jogador nгo encontrado!");
            return 1;
        }
        return true;
    }
    return 0;
}
Reply


Messages In This Thread
[AJUDA] Strtok - by crush_ - 04.06.2011, 18:54
Re: [AJUDA] Strtok - by [S]trong - 04.06.2011, 18:57
Re: [AJUDA] Strtok - by crush_ - 04.06.2011, 19:07
Re: [AJUDA] Strtok - by Falcon. - 04.06.2011, 19:38
Re: [AJUDA] Strtok - by crush_ - 04.06.2011, 19:51
Re: [AJUDA] Strtok - by Dr_Pawno - 04.06.2011, 20:38

Forum Jump:


Users browsing this thread: 3 Guest(s)