SA-MP Forums Archive
How to Fix That ? - 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: How to Fix That ? (/showthread.php?tid=88160)



How to Fix That ? - Geekzor - 24.07.2009

guys how i can fix my gametext ?

ok here is the code

Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
	new vehicleid;

	if(newstate == PLAYER_STATE_DRIVER)
	{
		vehicleid = GetPlayerVehicleID(playerid);

		if(gTeam[playerid] == TEAM_TERORIST && vehicleid == OBJECTIVE_VEHICLE_TERORIST)
		{ // It's the objective vehicle
		  GameTextForAll("~w~PLAYER %s (%d) IS DRIVING THE ~b~SOLIDER'S BULLET ~w~BACK ON ~r~TERORIST'S SPAWN, ~w~DESTROY HIM SOLIDERS !", 6000, 3);
		  gObjectiveGreenPlayer = playerid;
		}

		if(gTeam[playerid] == TEAM_SOLIDER && vehicleid == OBJECTIVE_VEHICLE_SOLIDER)
		{ // It's the objective vehicle
		  GameTextForAll("~w~PLAYER %s (%d) IS DRIVING THE ~r~TERORIST'S BULLET ~w~BACK ON ~b~SOLIDER'S SPAWN, ~w~DESTROY HIM TERORISTS !", 6000, 3);
		  gObjectiveBluePlayer = playerid;
		}
	}
	else if(newstate == PLAYER_STATE_ONFOOT)
	{
		if(playerid == gObjectiveGreenPlayer) {
		  gObjectiveGreenPlayer = (-1);
		  SetPlayerToTeamColor(playerid);
		}

		if(playerid == gObjectiveBluePlayer) {
		  gObjectiveBluePlayer = (-1);
		  SetPlayerToTeamColor(playerid);
		}
	}

  return 1;
}
i want when player enter to the bullet at terorist or soliders it write :

Example for Soliders:

Код:
GameTextForAll("~w~PLAYER %s (%d) IS DRIVING THE ~r~TERORIST'S BULLET ~w~BACK ON ~b~SOLIDER'S SPAWN, ~w~DESTROY HIM TERORISTS !", 6000, 3);
i give this ''%s (%d)'' to show player name and his ID but it wont ^^

here is the picture of my problem :

/imageshack/i/samp457.png/

so i want when player enter the Enemy Vehicle it Write: ''Player (players name and ID) ... bla bla bla''

not : ''Player %s (%d) ... bla bla bla''

So thanks for any help


Re: How to Fix That ? - Jefff - 24.07.2009

Use format
Код:
new str[128],nick[24];
GetPlayerName(playerid,nick,24);
format(str,128,"~w~PLAYER %s (%d) IS DRIVING THE ~r~TERORIST'S BULLET ~w~BACK ON ~b~SOLIDER'S SPAWN, ~w~DESTROY HIM TERORISTS !",nick,playerid);
GameTextForAll(str, 6000, 3);



Re: How to Fix That ? - Geekzor - 24.07.2009

uh thank you man