[Ajuda] passar pra strcmp
#8

pawn Код:
#include <a_samp>
#include <a_zones>

new Timer[MAX_PLAYERS];
forward Localizador(playerid, otherid);

public Localizador(playerid, otherid)
{
    if(!IsPlayerConnected(otherid)) return KillTimer(Timer[playerid]);
    new Float:x, Float:y, Float:z, Float:o_Distance, a[128], zone[MAX_ZONE_NAME];
    GetPlayerPos(otherid, x, y, z);
    o_Distance = GetPlayerDistanceFromPoint(playerid, x, y, z),
    format(a, sizeof(a), "%s~n~Distвncia: %0.2f metros~n~Local: %s", PlayerName(otherid), o_Distance, GetPlayer2DZone(otherid, zone, MAX_ZONE_NAME));
    GameTextForPlayer(playerid, a, 3000, 5);
    return 1;
}

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

    if(strcmp(cmd, "/Procurar", true) == 0)
    {
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp)) return SendClientMessage(playerid, -1, "Use /Procurar [id]");
        new otherid = strval(tmp);
        if(!IsPlayerConnected(otherid)) return false;
        Timer[playerid] = SetTimerEx("Localizador", 1500, true, "dd", playerid, otherid);
        return 1;
    }

    if(strcmp(cmd, "/Parar", true) == 0)
    {
        KillTimer(Timer[playerid]);
        return 1;
    }
    return 1;
}

stock PlayerName(playerid)
{
    new a[MAX_PLAYER_NAME];
    GetPlayerName(playerid, a, MAX_PLAYER_NAME);
    return a;
}

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;
}
Toma ai pro seu gm copia da NWD

@off
quase 666 posts
Reply


Messages In This Thread
passar pra strcmp - by Nayara._. - 10.09.2012, 01:56
Re: passar pra strcmp - by Victor' - 10.09.2012, 02:05
Re: passar pra strcmp - by paulor - 10.09.2012, 12:56
Re: passar pra strcmp - by Nayara._. - 10.09.2012, 22:01
Re: passar pra strcmp - by Q.I - 10.09.2012, 22:14
Re: passar pra strcmp - by Nayara._. - 10.09.2012, 22:24
Re: passar pra strcmp - by Victor' - 10.09.2012, 23:18
Re: passar pra strcmp - by DrTHE - 11.09.2012, 00:49
Re: passar pra strcmp - by Maklister - 11.09.2012, 01:31
Re: passar pra strcmp - by Nayara._. - 11.09.2012, 02:15

Forum Jump:


Users browsing this thread: 1 Guest(s)