Guest User

car color command

a guest
Mar 5th, 2011
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. if(strcmp(cmd, "/cc", true)== 0)
  2. {
  3. if(IsPlayerInAnyVehicle(playerid))
  4. {
  5. new length = strlen(cmdtext);
  6. while ((idx < length) && (cmdtext[idx] <= ' '))
  7. {
  8. idx++;
  9. }
  10. new offset = idx;
  11. new result[64];
  12. while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
  13. {
  14. result[idx - offset] = cmdtext[idx];
  15. idx++;
  16. }
  17. result[idx - offset] = EOS;
  18.  
  19. new vid = GetPlayerVehicleID(playerid);
  20. if(strval(result) && strval(result[2]) >126 || strval(result) && strval(result[2]) <0) return SendClientMessage(playerid, COLOR_RED, "Invalid color id!");
  21. ChangeVehicleColor(vid, strval(result), strval(result[2]));
  22. }
  23. else
  24. {
  25. SendClientMessage(playerid, COLOR_RED, "You are not in a vehicle!");
  26. }
  27. return 1;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment