SA-MP Forums Archive
[Question]Plate - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [Question]Plate (/showthread.php?tid=196351)



[Question]Plate - Gabb0411 - 05.12.2010

Hi, how can i color my license plate directly from game ?..I don't have any idea how to create a code for this..


Re: [Question]Plate - DVDK - 05.12.2010

You have to use RGB colors, so like this: "{RRGGBB} 1234 AB"


Re: [Question]Plate - Gabb0411 - 06.12.2010

I used in game .. /carplate {FFFFFF}Infernus to make the plate white..
and the plate still has the default color..


Re: [Question]Plate - Luis- - 06.12.2010

A code may help..


Re: [Question]Plate - Gabb0411 - 06.12.2010

My code is :
Код:
cmd(carplate, playerid, params[])
{
	#pragma unused params
	new string[256], car = PlayerInfo[playerid][pPcarkey], plate[32], playername[MAX_PLAYER_NAME]; GetPlayerName(playerid, playername, sizeof(playername));
 	if(car == 999) { SendClientMessage(playerid, COLOR_GRAD5, "You don't own a car !"); return 1; }
 	if(sscanf(params, "s", plate)) return SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /carplate [carnumber] (Max 10 characters).");
 	else {
 		if(car != 999 && strcmp(playername, CarInfo[car][cOwner], true) == 0) {
   			new payout = strlen(plate) * 10000; if(strlen(plate) > 10) return SendClientMessage(playerid, COLOR_WHITE, "You can't set more than 10 characters on your plate.");
   			if(GetPlayerMoney(playerid) < payout) { format(string, sizeof(string), "You don't have %d$ to pay the plate number.", payout); SendClientMessage(playerid, COLOR_WHITE, string); return 1; }
			SetVehicleNumberPlate(car, plate); GivePlayerMoney(playerid, -payout);
			CarInfo[car][cPlate] = plate;
			format(string, sizeof(string), "Your plate cost %d$ and you will see after next car respawn (%s).", payout, plate); SendClientMessage(playerid, COLOR_LIGHTBLUE3, string); OnPropUpdate();
		}
	}
	return 1;
}



Re: [Question]Plate - Gabb0411 - 09.12.2010

No one ?


Re: [Question]Plate - Rac3r - 09.12.2010

Hi, you need to respawn the vehicle first.

Here is my version (designed for my gamemode, so it won't work in yours without edit)
http://pastebin.com/8naPYvbC

Just use it as a guide, also wine won't allow colours with the 8 chat limit.
Bascially, do command, get player pos, set licence plate, set vehicle to resapwn, set vehicle pos.


Re: [Question]Plate - leong124 - 09.12.2010

Colour embedding cannot pass through command with this format: {FFFFFF}.
You may change the detection in some other format like "#FFFFFF ABCDE".
You may use sscanf(string,"h",hexcolor) to check hex code easier.


Re: [Question]Plate - Gabb0411 - 09.12.2010

Something like this ?
Код:
cmd(carplate, playerid, params[])
{
	#pragma unused params
	new string[256], car = PlayerInfo[playerid][pPcarkey], plate[32], playername[MAX_PLAYER_NAME], hexcolor; GetPlayerName(playerid, playername, sizeof(playername));
 	if(car == 999) { SendClientMessage(playerid, COLOR_GRAD5, "You don't own a car !"); return 1; }
 	if(sscanf(params, "hs", hexcolor, plate)) return SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /carplate [carnumber] (Max 10 characters).");
 	else {
 		if(car != 999 && strcmp(playername, CarInfo[car][cOwner], true) == 0) {
   			new payout = strlen(plate) * 10000;
   			if(GetPlayerMoney(playerid) < payout) { format(string, sizeof(string), "You don't have %d$ to pay the plate number.", payout); SendClientMessage(playerid, COLOR_WHITE, string); return 1; }
			SetVehicleNumberPlate(car, plate); GivePlayerMoney(playerid, -payout);
			CarInfo[car][cPlate] = plate;
			format(string, sizeof(string), "Your plate cost %d$ and you will see after next car respawn (%s).", payout, plate); SendClientMessage(playerid, COLOR_LIGHTBLUE3, string); OnPropUpdate();
		}
	}
	return 1;
}
It doesn't work.


Re: [Question]Plate - DVDK - 09.12.2010

Quote:
Originally Posted by Gabb0411
Посмотреть сообщение
Something like this ?
Код:
cmd(carplate, playerid, params[])
{
	#pragma unused params
	new string[256], car = PlayerInfo[playerid][pPcarkey], plate[32], playername[MAX_PLAYER_NAME], hexcolor; GetPlayerName(playerid, playername, sizeof(playername));
 	if(car == 999) { SendClientMessage(playerid, COLOR_GRAD5, "You don't own a car !"); return 1; }
 	if(sscanf(params, "hs", hexcolor, plate)) return SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /carplate [carnumber] (Max 10 characters).");
 	else {
 		if(car != 999 && strcmp(playername, CarInfo[car][cOwner], true) == 0) {
   			new payout = strlen(plate) * 10000;
   			if(GetPlayerMoney(playerid) < payout) { format(string, sizeof(string), "You don't have %d$ to pay the plate number.", payout); SendClientMessage(playerid, COLOR_WHITE, string); return 1; }
			SetVehicleNumberPlate(car, plate); GivePlayerMoney(playerid, -payout);
			CarInfo[car][cPlate] = plate;
			format(string, sizeof(string), "Your plate cost %d$ and you will see after next car respawn (%s).", payout, plate); SendClientMessage(playerid, COLOR_LIGHTBLUE3, string); OnPropUpdate();
		}
	}
	return 1;
}
It doesn't work.
You didn't respawned the car?