How to make a Car Color command?
#1

I'm just wondering how can you make a Car Color Command? I've tried searching on the wiki/forums, not luck finding anything similar.
Reply
#2

ChangeVehicleColor(vehicleid, color 1, color 2);

?

https://sampwiki.blast.hk/wiki/Color_ID
Reply
#3

Код:
if(!strcmp(cmdtext,"/carcolor",true,9)==0)
{
  new tmp[24],tmp2[24],Index, color1,color2;
  if(!IsPlayerInAnyVehicle(playerid) return SendClientMessage(playerid,oxffffffaa,"You mst be in car to use this command");
  if(!strlen(tmp) || !strlen(tmp2)) return SendClientMessage(playerid,0xffffffaa,"Usage: /carcolor color1 color2");
  tmp=strtok(cmdtext,Index);
  tmp2=strtok(cmdtext,Index);

  color1=strval(tmp);
  color2=strval(tmp2);

  ChangeVehicleColor(GetPlayerVehicleID(playerid),color1,color2);
  return 1;
}

Reply
#4

Quote:
Originally Posted by DJDhan
Код:
if(!strcmp(cmdtext,"/carcolor",true,9)==0)
{
  new tmp[24],tmp2[24],Index, color1,color2;

  if(!strlen(tmp) || !strlen(tmp2)) return SendClientMessage(playerid,0xffffffaa,"Usage: /carcolor color1 color2");
  color1=strtok(params,Index);
  color2=strtok(params,Index);

  ChangeVehicleColor(GetPlayerVehicleID(playerid),color1,color2);
  return 1;
}
Thankyou.
Reply
#5

I have edited my post. Please use the code now.
Reply
#6

edited out errors
Reply
#7

Just replace params with cmdtext. Edited again.
Reply
#8

Quote:
Originally Posted by DJDhan
Just replace params with cmdtext. Edited again.
Theres no errors, but when i do /carcolor 3 3 all it does is return the string "Usage: /carcolor color1 color2"
Reply
#9

Код:
	if(strcmp(cmd, "/carcolor", true) == 0){
	if(IsPlayerInAnyVehicle(playerid))
  {
  new color1, color2;
  tmp = strtok(cmdtext, idx);
  if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /carcolor >color1< >color2<");
  color1 = strval(tmp);
  tmp = strtok(cmdtext, idx);
  if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /carcolor >color1< >color2<");
  color2 = strval(tmp);
  ChangeVehicleColor(GetPlayerVehicleID(playerid), color1, color2);
  }
  else
  {
  SendClientMessage(playerid,COLOR_RED,"Your Not in any Vehicle!");
  }
  return 1;}
Reply
#10

Not a problem fella.
Reply
#11

Quote:
Originally Posted by _Ч§hмf†ҐЧ™_
Not a problem fella.
Just asking, Do you know how to make a /countdown command?
Reply
#12

Never tryed before, let me go try one, check back here soon.

EDIT

Top of script
Code:
new timer;
new secs;
The command.

Code:
if(!strcmp(cmd,"/countdown,true)) {
  secs = 5;
  timer = SetTimer("countdown", 999, 1);
  return 1;}
the function.

Code:
forward Countdown();
public Countdown()
{
if(secs == 0)
{
GameTextForAll("~r~Go!",1000,3);
KillTimer(timer);
}
else
{
new string[8];
format(string,sizeof(string),"~R~%d",secs);
GameTextForAll(string,1000,3);
}
secs = secs-1;
return 1;
}

Reply
#13

Quote:
Originally Posted by _Ч§hмf†ҐЧ™_
Never tryed before, let me go try one, check back here soon.
okay
Reply
#14

Edited my post. Go check,.
Reply
#15

E:\Kana.pwn(9 : error 017: undefined symbol "cmd"
E:\Kana.pwn(101) : error 017: undefined symbol "strtok"
E:\Kana.pwn(101) : error 029: invalid expression, assumed zero
E:\Kana.pwn(101) : error 017: undefined symbol "strtok"
E:\Kana.pwn(101) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


5 Errors.
Reply
#16

It's my script

// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT

#include <a_samp>

#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Blank Filterscript by your name here");
print("--------------------------------------\n");
return 1;
}

public OnFilterScriptExit()
{
return 1;
}

#else

main()
{
print("\n----------------------------------");
print(" Blank Gamemode by your name here");
print("----------------------------------\n");
}

#endif

public OnGameModeInit()
{
// Don't use these lines if it's a filterscript
SetGameModeText("Blank Script");
AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
return 1;
}

public OnGameModeExit()
{
return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
return 1;
}

public OnPlayerConnect(playerid)
{
return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
return 1;
}

public OnPlayerSpawn(playerid)
{
return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
return 1;
}

public OnVehicleSpawn(vehicleid)
{
return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
return 1;
}

public OnPlayerText(playerid, text[])
{
return 1;
}




public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmd, "/carcolor", true) == 0)
{
new color1, color2;
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /carcolor [color1] [color2]");
color1 = strval(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /carcolor [color1] [color2]");
color2 = strval(tmp);
ChangeVehicleColor(GetPlayerVehicleID(playerid), color1, color2);
return 1;
}


public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if (ispassenger)
Kick(playerid);
return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
return 1;
}

public OnPlayerLeaveRaceCheckpoint(playerid)
{
return 1;
}

public OnRconCommand(cmd[])
{
return 1;
}

public OnPlayerRequestSpawn(playerid)
{
return 1;
}



public OnObjectMoved(objectid)
{
return 1;
}

public OnPlayerObjectMoved(playerid, objectid)
{
return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
return 1;
}

public OnVehicleMod(playerid, vehicleid, componentid)
{
return 1;
}

public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
return 1;
}


public OnPlayerSelectedMenuRow(playerid, row)
{
return 1;
}

public OnPlayerExitedMenu(playerid)
{
return 1;
}

public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
return 1;
}

public OnRconLoginAttempt(ip[], password[], success)
{
return 1;
}

public OnPlayerUpdate(playerid)
{
return 1;
}

public OnPlayerStreamIn(playerid, forplayerid)
{
return 1;
}

public OnPlayerStreamOut(playerid, forplayerid)
{
return 1;
}

public OnVehicleStreamIn(vehicleid, forplayerid)
{
return 1;
}

public OnVehicleStreamOut(vehicleid, forplayerid)
{
return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
return 1;
}

public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
return 1;
}
Reply
#17

Please Help :/
Reply
#18

Code:
#include <a_samp>

public OnPlayerCommandText(playerid, cmdtext[])
{
	new cmd[256], tmp[256], idx;
	if(strcmp(cmd, "/carcolor", true) == 0)
	{
		new color1, color2;
		tmp = strtok(cmdtext, idx);
		if(!strlen(tmp)) return SendClientMessage(playerid, -1, "USAGE: /carcolor [color1] [color2]");
		color1 = strval(tmp);
		tmp = strtok(cmdtext, idx);
		if(!strlen(tmp)) return SendClientMessage(playerid, -1, "USAGE: /carcolor [color1] [color2]");
		color2 = strval(tmp);
		ChangeVehicleColor(GetPlayerVehicleID(playerid), color1, color2);
		return 1;
	}
	return 0;
}
stock 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
#19

can you give me command which will change vehcle color in eversecond?



and thanks for
/carcolor command it's working fine
Reply
#20

Quote:
Originally Posted by -Rebel Son-
Посмотреть сообщение
Код:
	if(strcmp(cmd, "/carcolor", true) == 0){
	if(IsPlayerInAnyVehicle(playerid))
  {
  new color1, color2;
  tmp = strtok(cmdtext, idx);
  if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /carcolor >color1< >color2<");
  color1 = strval(tmp);
  tmp = strtok(cmdtext, idx);
  if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /carcolor >color1< >color2<");
  color2 = strval(tmp);
  ChangeVehicleColor(GetPlayerVehicleID(playerid), color1, color2);
  }
  else
  {
  SendClientMessage(playerid,COLOR_RED,"Your Not in any Vehicle!");
  }
  return 1;}
Код:
E:\R5 0.3c Server\gamemodes\SevenStar.pwn(1050) : error 017: undefined symbol "cmd"
E:\R5 0.3c Server\gamemodes\SevenStar.pwn(1054) : error 017: undefined symbol "tmp"
E:\R5 0.3c Server\gamemodes\SevenStar.pwn(1054) : error 017: undefined symbol "idx"
E:\R5 0.3c Server\gamemodes\SevenStar.pwn(1055) : error 017: undefined symbol "tmp"
E:\R5 0.3c Server\gamemodes\SevenStar.pwn(1056) : error 017: undefined symbol "tmp"
E:\R5 0.3c Server\gamemodes\SevenStar.pwn(1057) : error 017: undefined symbol "tmp"
E:\R5 0.3c Server\gamemodes\SevenStar.pwn(1057) : error 017: undefined symbol "idx"
E:\R5 0.3c Server\gamemodes\SevenStar.pwn(1058) : error 017: undefined symbol "tmp"
E:\R5 0.3c Server\gamemodes\SevenStar.pwn(1059) : error 017: undefined symbol "tmp"
HELP ME
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)