Can someone explain to me
#1

So, I will start from that, that i was created race and there is one code, which check in what car you sitting, so it will know the car id and if this id is equal to 411(infernus) or 451(turismo), it'll create checkpoint and send message to player-Now you can start the race!But i found some indistinctness with some code lines-i created it myself and used a bit of other people knowledge.So first I will show you the code which do things, which i wrote recently and then after that i will ask you something
Код:
{
	new string[39];
	format(string, sizeof(string), "Now you can start the race!", 1, 2);
	vehicle = GetVehicleModel(GetPlayerVehicleID(playerid));
	if(vehicle == 411)
	{
	cp[playerid] = SetPlayerRaceCheckpoint(playerid, 0, -2334.7681,-2179.3489,35.1945, -2143.2742,-2006.9039,95.0157, 9);
	}
	else if(vehicle == 451)
	{
	cp[playerid] = SetPlayerRaceCheckpoint(playerid, 0, -2334.7681,-2179.3489,35.1945, -2143.2742,-2006.9039,95.0157, 9);
	SendClientMessage(playerid, 0xFFFFFFFF, string);
	return 1;
	}
	return 0;
}
Ok, so this is my code I was talking about, and actually you see some lines are bold, i did this, because i want to ask something about it.Ok, so is i'm right if i will delete these bold lines and variable string.And istead of string in the end of the code(where is function SendClientMessage) I write this message-"Now you can start the race!"-which was included into variable string before?I think it will be more optimised code, it will use less memory, because there will be less code, isn't i'm right?I know that in this format function are parameters like old and new state, but why i need it if code only will start, when i will be in a vehicle?Because when I'm on foot server will understand it and don't check the vehicle id.So i think you understand what i want to know.Thank you!
Reply
#2

So there is no one who understand what i'm talking? DDD
Reply
#3

Yeah you don't need format there.

However, if you have several "SendClientMessage" with the same message you should do:
pawn Код:
static string[ ] = "blablabla";

...

SendClientMessage( playerid, 0xFFFFFFFF, string );

...

SendClientMessage( playerid, 0xFFFFFFFF, string );
Reply
#4

Quote:
Originally Posted by g_aSlice
Посмотреть сообщение
Yeah you don't need format there.

However, if you have several "SendClientMessage" with the same message you should do:
pawn Код:
static string[ ] = "blablabla";

...

SendClientMessage( playerid, 0xFFFFFFFF, string );

...

SendClientMessage( playerid, 0xFFFFFFFF, string );
Thank you man, now i understand it :P
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)