[Ajuda] passar pra strcmp
#1

alguem me ajuda a passar ese cod pra strcmp

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

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;
}

CMD:procurar(playerid, params[])
{
    if(isnull(params)) return false;
    new otherid = strval(params);
    if(!IsPlayerConnected(otherid)) return false;
    Timer[playerid] = SetTimerEx("Localizador", 1500, true, "dd", playerid, otherid);
    return 1;
}

CMD:parar(playerid, params[])
{
    #pragma unused params
    KillTimer(Timer[playerid]);
    return 1;
}

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

pawn Код:
if(!strcmp(cmdtext, "/procurar", true, 8))
{
    new params = cmdtext[9];
   
    if(!strlen(params)) return false;
    new otherid = strval(params);
   
    if(!IsPlayerConnected(otherid)) return false;
   
    Timer[playerid] = SetTimerEx("Localizador", 1500, true, "dd", playerid, otherid);
    return 1;
}

if(!strcmp(cmdtext, "/parar", true, 5))
{
    KillTimer(Timer[playerid]);
    return 1;
}
Reply
#3

Quote:
Originally Posted by Victor'
Посмотреть сообщение
pawn Код:
if(!strcmp(cmdtext, "/procurar", true, 8))
{
    new params = cmdtext[9];
   
    if(!strlen(params)) return false;
    new otherid = strval(params);
   
    if(!IsPlayerConnected(otherid)) return false;
   
    Timer[playerid] = SetTimerEx("Localizador", 1500, true, "dd", playerid, otherid);
    return 1;
}

if(!strcmp(cmdtext, "/parar", true, 5))
{
    KillTimer(Timer[playerid]);
    return 1;
}
Vitor vc deve contar a barra tbm cara...
Reply
#4

n deu
Reply
#5

Quote:
Originally Posted by Nayara._.
Посмотреть сообщение
n deu
voзe ja tentou fazer sozinha em vez de pedir codigo pronto ?



#edit a respeito dos erros cade ?
Reply
#6

sim sim, sу q deu errosssssssssss muitos errosssssssss 8
Reply
#7

Quote:
Originally Posted by paulor
Посмотреть сообщение
Vitor vc deve contar a barra tbm cara...
Nгo entendi '-'

Seria assim?
"/procurar" = "/ = 0", "p = 1", "r = 2", "o = 3", "c = 4", "u = 5", "r = 6", "a = 7", "r = 8"
012345678

# Topic

Poste os erros
Reply
#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
#9

THE_FALLEN

Joga Nwd ?
Reply
#10

nwd ? nem joguei nesse sv mais ouvi falar, eu jogava na tssa, la tem de tudo do bom e do mior

the falen mais fica dando erro fala alguma coisa <a_zones>
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)