How do I make this in ZCMD?
#5

This is the right code:
pawn Код:
CMD:changecolor(playerid, params[])
{
    if(IsPlayerInAnyVehicle(playerid))
    {
          new color1, color2, tmp[128];
          tmp = strtok(cmdtext, idx);
          if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_ORANGE, "USAGE: /carcolor >color1< >color2<");
          color1 = strval(tmp);
          tmp = strtok(cmdtext, idx);
          if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_ORANGE, "USAGE: /carcolor >color1< >color2<");
          color2 = strval(tmp);
          ChangeVehicleColor(GetPlayerVehicleID(playerid), color1, color2);
    }    
    else
    {
          SendClientMessage(playerid,COLOR_ORANGE,"You aren't in any Vehicle!");
    }    
    return 1;
}
Add this in last of your script:
pawn Код:
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
How do I make this in ZCMD? - by jNkk - 22.12.2012, 15:18
Re: How do I make this in ZCMD? - by DaRk_RaiN - 22.12.2012, 15:21
Re: How do I make this in ZCMD? - by jNkk - 22.12.2012, 15:24
Re: How do I make this in ZCMD? - by DaRk_RaiN - 22.12.2012, 15:28
Re: How do I make this in ZCMD? - by Faisal_khan - 22.12.2012, 15:28
Re: How do I make this in ZCMD? - by jNkk - 22.12.2012, 15:38
Re: How do I make this in ZCMD? - by jNkk - 22.12.2012, 15:40
Re: How do I make this in ZCMD? - by Faisal_khan - 22.12.2012, 15:42
Re: How do I make this in ZCMD? - by DaRk_RaiN - 22.12.2012, 15:43
Re: How do I make this in ZCMD? - by jNkk - 22.12.2012, 15:52

Forum Jump:


Users browsing this thread: 1 Guest(s)