textdraw hide problem
#1

when a player spawn the textdraws doent hide. i use gteam.

Код:
public OnPlayerSpawn(playerid)
{
	if(GetPlayerTeam(playerid) == TEAM_WANG)
	{
		SetPlayerArmour(playerid,100);
		SetPlayerHealth(playerid,100);
		SetPlayerFightingStyle (playerid, FIGHT_STYLE_KUNGFU);
		TextDrawHideForPlayer(playerid, Wang);
	}
	else if(GetPlayerTeam(playerid) == TEAM_OTTOS)
	{
	  SetPlayerHealth(playerid,100);
	  SetPlayerArmour(playerid,100);
	  SetPlayerFightingStyle (playerid, FIGHT_STYLE_KUNGFU);
	  TextDrawHideForPlayer(playerid, Ottos);
  }
	return 1;
}
pls help!
Reply
#2

Here you go.

Код:
public OnPlayerSpawn(playerid)
{
	if(GetPlayerTeam(playerid) == TEAM_WANG)
	{
		TextDrawHideForPlayer(playerid, Wang);
		SetPlayerArmour(playerid,100);
		SetPlayerHealth(playerid,100);
		SetPlayerFightingStyle (playerid, FIGHT_STYLE_KUNGFU);
	}
	else if(GetPlayerTeam(playerid) == TEAM_OTTOS)
	{
         TextDrawHideForPlayer(playerid, Ottos);
	  SetPlayerHealth(playerid,100);
	  SetPlayerArmour(playerid,100);
	  SetPlayerFightingStyle (playerid, FIGHT_STYLE_KUNGFU);	 
  }
	return 1;
}
Reply
#3

thanks for help but i found my problem. gteams are not working i have this code

Код:
#include <a_samp>


#define TEAM_WANG 0
#define TEAM_OTTOS 1

new gTeam[MAX_PLAYERS];
new Text:Wang;
new Text:Ottos;

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

public OnGameModeInit()
{
	SetGameModeText("Blank Script");
	AllowAdminTeleport(1);

	AddPlayerClass(50, -1948.084228, 262.652984, 41.047080, 91.840896, 0, 0, 0, 0, 0, 0);//wang member
	AddPlayerClass(268, -1679.083007, 1209.106811, 21.156250, 280.927642, 0, 0, 0, 0, 0, 0);//ottos member

  Wang = TextDrawCreate(555.000000, 311.000000, "Wang Member");
	TextDrawAlignment(Wang, 2);
	TextDrawBackgroundColor(Wang, 255);
	TextDrawFont(Wang, 0);
	TextDrawLetterSize(Wang, 0.900000, 4.400000);
	TextDrawColor(Wang, 65535);
	TextDrawSetOutline(Wang, 1);
	TextDrawSetProportional(Wang, 1);

	Ottos = TextDrawCreate(555.000000, 311.000000, "Ottos Member");
	TextDrawAlignment(Ottos, 2);
	TextDrawBackgroundColor(Ottos, 0x00ff00ff);
	TextDrawFont(Ottos, 0);
	TextDrawLetterSize(Ottos, 0.900000, 4.400000);
	TextDrawColor(Ottos, 65535);
	TextDrawSetOutline(Ottos, 1);
	TextDrawSetProportional(Ottos, 1);

	return 1;
}

public OnGameModeExit()
{
	return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
  SetPlayerTeamFromClass(playerid, classid);
	switch (classid)
	{

		case 0:

		  {
        SetPlayerPos(playerid, -1948.588256, 266.454284, 41.053413);
				SetPlayerFacingAngle(playerid, 89.624229);
				SetPlayerCameraLookAt(playerid, -1948.588256, 266.454284, 41.053413);
				SetPlayerCameraPos(playerid, -1948.588256 + (5 * floatsin(-89.624229, degrees)), 266.454284 + (5 * floatcos(-89.624229, degrees)), 41.053413);
        gTeam[playerid] = TEAM_WANG;
				TextDrawShowForPlayer(playerid, Wang);
        TextDrawHideForPlayer(playerid, Ottos);

			 }
		 case 1:

			{
			  SetPlayerPos(playerid, -1679.394165, 1209.123779, 21.156250);
				SetPlayerFacingAngle(playerid, 284.327575);
				SetPlayerCameraLookAt(playerid, -1679.394165, 1209.123779, 21.156250);
				SetPlayerCameraPos(playerid, -1679.394165 + (5 * floatsin(-284.327575, degrees)), 1209.123779 + (5 * floatcos(-284.327575, degrees)), 21.156250);
        gTeam[playerid] = TEAM_OTTOS;
				TextDrawShowForPlayer(playerid, Ottos);
        TextDrawHideForPlayer(playerid, Wang);

			 }
  }
  return 1;
}

stock SetPlayerTeamFromClass(playerid, classid)
{
  if(classid == 0)
   {
   gTeam[playerid] = TEAM_WANG;
   }
  else if(classid == 1)
  {
  gTeam[playerid] = TEAM_OTTOS;
	}
  return 1;
}

public OnPlayerConnect(playerid)
{
	return 1;
}

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

public OnPlayerSpawn(playerid)
{
	if(GetPlayerTeam(playerid) == TEAM_WANG)
	{
    TextDrawHideForPlayer(playerid, Wang);
		SetPlayerArmour(playerid,100);
		SetPlayerHealth(playerid,100);
		SetPlayerFightingStyle (playerid, FIGHT_STYLE_KUNGFU);
		
		//TextDrawDestroy(Wang);

	}
	else if(GetPlayerTeam(playerid) == TEAM_OTTOS)
	{
    TextDrawHideForPlayer(playerid, Ottos);
		SetPlayerHealth(playerid,100);
	  SetPlayerArmour(playerid,100);
	  SetPlayerFightingStyle (playerid, FIGHT_STYLE_KUNGFU);
	  
	  //TextDrawDestroy(Ottos);

  }
	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("/mycommand", cmdtext, true, 10) == 0)
	{
		// Do something here
		return 1;
	}
	return 0;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
	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 OnVehicleRespray(playerid, vehicleid, color1, color2)
{
	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;
}
i dont know where is the problem on the code. gteams are not working.

pls help!!
Reply
#4

Here you go:
Код:
#include <a_samp>


#define TEAM_WANG 0
#define TEAM_OTTOS 1

new gTeam[MAX_PLAYERS];
new Text:Wang;
new Text:Ottos;

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

public OnGameModeInit()
{
	SetGameModeText("Blank Script");
	AllowAdminTeleport(1);

	AddPlayerClass(50, -1948.084228, 262.652984, 41.047080, 91.840896, 0, 0, 0, 0, 0, 0);//wang member
	AddPlayerClass(268, -1679.083007, 1209.106811, 21.156250, 280.927642, 0, 0, 0, 0, 0, 0);//ottos member

  Wang = TextDrawCreate(555.000000, 311.000000, "Wang Member");
	TextDrawAlignment(Wang, 2);
	TextDrawBackgroundColor(Wang, 255);
	TextDrawFont(Wang, 0);
	TextDrawLetterSize(Wang, 0.900000, 4.400000);
	TextDrawColor(Wang, 65535);
	TextDrawSetOutline(Wang, 1);
	TextDrawSetProportional(Wang, 1);

	Ottos = TextDrawCreate(555.000000, 311.000000, "Ottos Member");
	TextDrawAlignment(Ottos, 2);
	TextDrawBackgroundColor(Ottos, 0x00ff00ff);
	TextDrawFont(Ottos, 0);
	TextDrawLetterSize(Ottos, 0.900000, 4.400000);
	TextDrawColor(Ottos, 65535);
	TextDrawSetOutline(Ottos, 1);
	TextDrawSetProportional(Ottos, 1);

	return 1;
}

public OnGameModeExit()
{
	return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
  
	switch (classid)
	{

		case 0:

		  {
        SetPlayerPos(playerid, -1948.588256, 266.454284, 41.053413);
				SetPlayerFacingAngle(playerid, 89.624229);
				SetPlayerCameraLookAt(playerid, -1948.588256, 266.454284, 41.053413);
				SetPlayerCameraPos(playerid, -1948.588256 + (5 * floatsin(-89.624229, degrees)), 266.454284 + (5 * floatcos(-89.624229, degrees)), 41.053413);
        gTeam[playerid] = TEAM_WANG;
				TextDrawShowForPlayer(playerid, Wang);
        TextDrawHideForPlayer(playerid, Ottos);

			}
		case 1:

			{
			  SetPlayerPos(playerid, -1679.394165, 1209.123779, 21.156250);
				SetPlayerFacingAngle(playerid, 284.327575);
				SetPlayerCameraLookAt(playerid, -1679.394165, 1209.123779, 21.156250);
				SetPlayerCameraPos(playerid, -1679.394165 + (5 * floatsin(-284.327575, degrees)), 1209.123779 + (5 * floatcos(-284.327575, degrees)), 21.156250);
        gTeam[playerid] = TEAM_OTTOS;
				TextDrawShowForPlayer(playerid, Ottos);
        TextDrawHideForPlayer(playerid, Wang);

			}
  }

  SetPlayerTeamFromClass(playerid, classid);
  return 1;
}

stock SetPlayerTeamFromClass(playerid, classid)
{
  if(classid == 0)
   {
   gTeam[playerid] = TEAM_WANG;
   }
  else if(classid == 1)
  {
  gTeam[playerid] = TEAM_OTTOS;
	}
  return 1;
}

public OnPlayerConnect(playerid)
{
	return 1;
}

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

public OnPlayerSpawn(playerid)
{


SetPlayerTeam(playerid,gTeam[playerid];


	if(gTeam[playerid] == TEAM_WANG)
	{
    TextDrawHideForPlayer(playerid, Wang);
		SetPlayerArmour(playerid,100);
		SetPlayerHealth(playerid,100);
		SetPlayerFightingStyle (playerid, FIGHT_STYLE_KUNGFU);
		
		//TextDrawDestroy(Wang);

	}
	else if(gTeam[playerid] == TEAM_OTTOS)
	{
    TextDrawHideForPlayer(playerid, Ottos);
		SetPlayerHealth(playerid,100);
	  SetPlayerArmour(playerid,100);
	  SetPlayerFightingStyle (playerid, FIGHT_STYLE_KUNGFU);
	  
	  //TextDrawDestroy(Ottos);

  }
	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("/mycommand", cmdtext, true, 10) == 0)
	{
		// Do something here
		return 1;
	}
	return 0;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
	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 OnVehicleRespray(playerid, vehicleid, color1, color2)
{
	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
#5

thanks DJDhan!!! worked!!
Reply
#6

Quote:
Originally Posted by billiout
thanks DJDhan!!! worked!!
Glad to help.

Also i would like you to know that SetPlayerTeam(playerid,gTeam[playerid]) is the code for Anti-Team Kill. I learned it the hard way :P
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)