[HELP] Hide Name
#4

Maybe store their name in a file or a variable, then when you type /showme again your name would be set back to your old name, like the code below me, but logging would reset the variable, so here, try this:

pawn Код:
#include <a_samp>

new Name[MAX_PLAYERS];

public OnPlayerCommandText(playerid, cmdtext[])
{
    new cmd[256];
    new idx;
    cmd = strtok(cmdtext, idx);

    if(strcmp(cmd, "/hideme", true) == 0) {
        new randstring[4], PlayerName, pName[MAX_PLAYER_NAME];
        new randnumber = 127 + random(71762);
        PlayerName = GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
        Name[playerid] = PlayerName;
        format(randstring, sizeof(randstring), "Unknown_%d",randnumber);
        SetPlayerName(playerid, randstring);
        SendClientMessage(playerid, 0xFFFFFFAA, "You hid yourself.");
        SetPlayerColor(playerid, 0x00000000);
        return true;
    }
    if(strcmp(cmd, "/showme", true) == 0) {
        SetPlayerName(playerid, Name[playerid]);
        SendClientMessage(playerid, 0xFFFFFFAA, "You revealed yourself.");
        SetPlayerColor(playerid, 0xFFFFFFAA);
        return true;
    }
    return 0;
}


strtok(const string[], &index)
{
    new length = strlen(string);
    while ((index < length) && (string[index] <= ' ')) {
        index++;
    }

    new offset = index;
    new result[20];
    while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1))) {
        result[index - offset] = string[index];
        index++;
    }
    result[index - offset] = EOS;
    return result;
}
Reply


Messages In This Thread
[HELP] Hide Name - by Larsey123IsMe - 10.12.2010, 00:39
Re: [HELP] Hide Name - by Hal - 10.12.2010, 00:47
Re: [HELP] Hide Name - by Retardedwolf - 10.12.2010, 00:50
Re: [HELP] Hide Name - by case 1337: - 10.12.2010, 01:14
Re: [HELP] Hide Name - by Steven82 - 10.12.2010, 01:19

Forum Jump:


Users browsing this thread: 1 Guest(s)