[Ajuda] Pintar [ID] [ID]
#6

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[]) {

    new cmd[128], idx;
    new tmp[128];
   
    cmd = strtok(cmdtext, idx);

    if (!strcmp(cmd, "/pintarcarro") ) {

        if ( !IsPlayerInAnyVehicle(playerid))
            return SendClientMessage(playerid, -1, "Vocк nгo esta em nenhum veнculo!");

        tmp = strtok(cmdtext, idx);

        if ( !strlen(tmp) )
            return SendClientMessage(playerid, -1, "Use /pintarcarro [cor 1] [cor 2]");

        new cor1 = strval(tmp);

        tmp = strtok(cmdtext, idx);

        if ( !strlen(tmp) )
            return SendClientMessage(playerid, -1, "Use /pintarcarro [cor 1] [cor 2]");

        new cor2 = strval(tmp);

        if ( cor1 > 241 || cor1 < 0 || cor2 > 241 || cor2 < 0)
            return SendClientMessage(playerid, -1, "Cor invбlida! Use valores entre 0 e 241!");


        ChangeVehicleColor(GetPlayerVehicleID (playerid), cor1 , cor2 );
        format (tmp, sizeof tmp, "Cores do veнculo alteradas! Cor 1 agora й %d e cor 2 й %d", cor1, cor2);
        SendClientMessage(playerid, -1, tmp);

        return 1;
    }

    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;
}
Somente redefina o nъmero de cйlulas!
Reply


Messages In This Thread
Pintar [ID] [ID] - by jonathan_agv - 08.01.2014, 21:08
Re: Pintar [ID] [ID] - by Gii - 08.01.2014, 21:26
Re: Pintar [ID] [ID] - by jonathan_agv - 08.01.2014, 22:13
Re: Pintar [ID] [ID] - by GodsAndMonsters - 08.01.2014, 22:15
Re: Pintar [ID] [ID] - by jonathan_agv - 08.01.2014, 22:19
Re: Pintar [ID] [ID] - by Gii - 08.01.2014, 22:28
Re: Pintar [ID] [ID] - by jonathan_agv - 08.01.2014, 22:36
Re: Pintar [ID] [ID] - by jonathan_agv - 08.01.2014, 22:51
Re: Pintar [ID] [ID] - by jonathan_agv - 08.01.2014, 22:57
Re: Pintar [ID] [ID] - by jonathan_agv - 08.01.2014, 23:02

Forum Jump:


Users browsing this thread: 1 Guest(s)