SA-MP Forums Archive
Textdraw - 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)
+--- Thread: Textdraw (/showthread.php?tid=393137)



Textdraw - Mustafa6155 - 17.11.2012

Hey guys I got in me ITD

This but when i load anything i export anything to PWN.
Then i got this

And how to make click able when he does the first one he by an Rapist etc.
Or u do f6 or T (chat) and type the numbers. and U will so the skill.


Re: Textdraw - Ballu Miaa - 17.11.2012

EDit: Check the post below


Re: Textdraw - Mustafa6155 - 17.11.2012

and how do if player press "T" or F6 and type 1 then opens another texdraw??

pawno crashing when i do this
Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{

	new string[128];
	
 	if (newkeys == KEY_FIRE) // You can also add more checks that TD is shown to the player or not!
    {
           	TextDrawDestroy(Textdraw0);//Change TextDraw Name here! this this
           	TextDrawDestroy(Textdraw1);//Change TextDraw Name here! this this
           	TextDrawDestroy(Textdraw2);//Change TextDraw Name here! this this
           	TextDrawDestroy(Textdraw3);//Change TextDraw Name here! this this
           	TextDrawDestroy(Textdraw4);//Change TextDraw Name here! this this
           	TextDrawDestroy(Textdraw5);//Change TextDraw Name here! this this
           	TextDrawDestroy(Textdraw6);//Change TextDraw Name here! this this
           	TextDrawDestroy(Textdraw7);//Change TextDraw Name here! this this
           	TextDrawDestroy(Textdraw8);//Change TextDraw Name here! this this
           	TextDrawDestroy(Textdraw9);//Change TextDraw Name here! this this
           	TextDrawDestroy(Textdraw10);//Change TextDraw Name here! this this
   	}
    return 1;
}

	if(newkeys == KEY_LOOK_BEHIND) //Starting / Stoping vehicle engine
	{
	    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
	    {
			new engine,lights,alarm,doors,bonnet,boot,objective;
			new vid = GetPlayerVehicleID(playerid);
		    GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
			if(engine == VEHICLE_PARAMS_ON && !IsAPlane(vid) && !IsACycleBike(vid))
			{
			    SpamStrings[playerid] +=2;
			    if(SpamStrings[playerid] >= MAX_SPAM)
				{
				    SendClientMessage(playerid, COLOR_WHITE, "Please do not spam. Please wait before trying to turn on/off the engine again.");
				    return 0;
			    }
				SetVehicleParamsEx(vid,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
				for(new i=0; i<MAX_PLAYERS; i++)
				{
				    if(GetDistanceBetweenPlayers(playerid,i) < 10)
				    {
				        format(string,sizeof(string),"%s(%d) spins the vehicle's engine key and turns off the engine.",PlayerName(playerid),playerid);
						SendClientMessage(i,COLOR_LIGHTBLUE,string);
					}
				}
				return 1;
			}
		if(engine != VEHICLE_PARAMS_ON && !IsAPlane(vid) && !IsACycleBike(vid))
			{
			    SpamStrings[playerid] +=2;
			    if(SpamStrings[playerid] >= MAX_SPAM)
				{
				    SendClientMessage(playerid, COLOR_WHITE, "Please do not spam. Please wait before trying to turn on/off the engine again.");
				    return 0;
			    }
				SetVehicleParamsEx(vid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
				for(new i=0; i<MAX_PLAYERS; i++)
				{
				    if(GetDistanceBetweenPlayers(playerid,i) < 10)
				    {
						format(string,sizeof(string),"%s(%d) spins the vehicle's engine key and turns on the engine.",PlayerName(playerid),playerid);
						SendClientMessage(i,COLOR_LIGHTBLUE,string);
					}
				}
				return 1;
			}
		}
		return 1;
	}

    if(newkeys & KEY_SECONDARY_ATTACK && PlayerToPoint(1.0, playerid, -1619.1694,689.5911,7.1875)) //SFPD Shutter Inside
	{
		if(gTeam[playerid] != TEAM_SWAT && gTeam[playerid] != TEAM_COP && gTeam[playerid] != TEAM_ARMY)
		{
			SendClientMessage(playerid,COLOR_WHITE,"{FF0000}[ERROR]: {FFFFFF}Access Denied");
			return 1;
		}
		SpamStrings[playerid] +=2;
	    if(SpamStrings[playerid] >= MAX_SPAM)
		{
		    SendClientMessage(playerid, COLOR_WHITE, "Please do not spam. Please wait before opening/closing again.");
		    return 0;
	    }
		SetPlayerPos(playerid, -1619.1694,689.5911,7.1875);
		SetPlayerFacingAngle(playerid, 269.9927);
		LoopingAnim(playerid, "HEIST9", "Use_SwipeCard", 3.0, 0, 0, 0, 0, 0);
		if(SFPDShutterOpen == 0)
		{
			MoveObject(SFPDShutter, -1620.61669922,688.17712402,12.80728531, 4);
			SendClientMessage(playerid, COLOR_DODGERBLUE, "Access Granted");
			SFPDShutterOpen =1;
			return 1;
		}
		if(SFPDShutterOpen == 1)
		{
			MoveObject(SFPDShutter, -1620.61669922,688.17712402,7.80728531, 4);
			SFPDShutterOpen =0;
			return 1;
		}
		return 1;
	}

	if(newkeys & KEY_SECONDARY_ATTACK && PlayerToPoint(1.0, playerid, -1622.1335,687.1992,7.1875)) //SFPD Shutter Outside
	{
		if(gTeam[playerid] != TEAM_SWAT && gTeam[playerid] != TEAM_COP && gTeam[playerid] != TEAM_ARMY)
		{
			SendClientMessage(playerid,COLOR_WHITE,"{FF0000}[ERROR]: {FFFFFF}Access Denied");
			return 1;
		}
		SpamStrings[playerid] +=2;
	    if(SpamStrings[playerid] >= MAX_SPAM)
		{
		    SendClientMessage(playerid, COLOR_WHITE, "Please do not spam. Please wait before opening/closing again.");
		    return 0;
	    }
		SetPlayerPos(playerid, -1622.1335,687.1992,7.1875);
		SetPlayerFacingAngle(playerid, 0.2336);
		LoopingAnim(playerid, "HEIST9", "Use_SwipeCard", 3.0, 0, 0, 0, 0, 0);
		if(SFPDShutterOpen == 0)
		{
			MoveObject(SFPDShutter, -1620.61669922,688.17712402,12.80728531, 4);
			SendClientMessage(playerid, COLOR_DODGERBLUE, "Access Granted");
			SFPDShutterOpen =1;
			return 1;
		}
		if(SFPDShutterOpen == 1)
		{
			MoveObject(SFPDShutter, -1620.61669922,688.17712402,7.80728531, 4);
			SFPDShutterOpen =0;
			return 1;
		}
		return 1;
	}
	
	if(newkeys & KEY_SECONDARY_ATTACK && PlayerToPoint(1.0, playerid, 245.3787,73.5715,1003.6406)) //FBI Shutter Inside
	{
		if(GetPlayerSkin(playerid) != 286)
		{
			SendClientMessage(playerid,COLOR_WHITE,"{FF0000}[ERROR]: {FFFFFF}Access Denied");
			return 1;
		}
		SpamStrings[playerid] +=2;
	    if(SpamStrings[playerid] >= MAX_SPAM)
		{
		    SendClientMessage(playerid, COLOR_WHITE, "Please do not spam. Please wait before opening/closing again.");
		    return 0;
	    }
		SetPlayerPos(playerid, 245.3787,73.5715,1003.6406);
		SetPlayerFacingAngle(playerid, 91.2136);
		LoopingAnim(playerid, "HEIST9", "Use_SwipeCard", 3.0, 0, 0, 0, 0, 0);
		if(FBIShutterOpen == 0)
		{
			MoveObject(FBIShutter, 246.42794800,72.70855713,1009.26043701, 3);
			SendClientMessage(playerid, COLOR_DODGERBLUE, "Access Granted");
			FBIShutterOpen =1;
			return 1;
		}
		if(FBIShutterOpen == 1)
		{
			MoveObject(FBIShutter, 246.42794800,72.70855713,1004.26043701, 3);
			FBIShutterOpen =0;
			return 1;
		}
		return 1;
	}

	if(newkeys & KEY_SECONDARY_ATTACK && PlayerToPoint(1.0, playerid, 247.7420,71.6222,1003.6406)) //FBI Shutter Outside
	{
		if(GetPlayerSkin(playerid) != 286)
		{
			SendClientMessage(playerid,COLOR_WHITE,"{FF0000}[ERROR]: {FFFFFF}Access Denied");
			return 1;
		}
		SpamStrings[playerid] +=2;
	    if(SpamStrings[playerid] >= MAX_SPAM)
		{
		    SendClientMessage(playerid, COLOR_WHITE, "Please do not spam. Please wait before opening/closing again.");
		    return 0;
	    }
		SetPlayerPos(playerid, 247.7420,71.6222,1003.6406);
		SetPlayerFacingAngle(playerid, 3.7928);
		LoopingAnim(playerid, "HEIST9", "Use_SwipeCard", 3.0, 0, 0, 0, 0, 0);
		if(FBIShutterOpen == 0)
		{
			MoveObject(FBIShutter, 246.42794800,72.70855713,1009.26043701, 3);
			SendClientMessage(playerid, COLOR_DODGERBLUE, "Access Granted");
			FBIShutterOpen =1;
			return 1;
		}
		if(FBIShutterOpen == 1)
		{
			MoveObject(FBIShutter, 246.42794800,72.70855713,1004.26043701, 3);
			FBIShutterOpen =0;
			return 1;
		}
		return 1;
	}
	return 1;
}



Re: Textdraw - Ballu Miaa - 17.11.2012

Quote:
Originally Posted by Mustafa6155
Посмотреть сообщение
and how do if player press "T" or F6 and type 1 then opens another texdraw??

And i got those errors.
Код:
C:\Users\Mustafa\Desktop\SAmp SRV\ForYou\gamemodes\SFCRRPG.pwn(10035) : error 017: undefined symbol "newkeys"
C:\Users\Mustafa\Desktop\SAmp SRV\ForYou\gamemodes\SFCRRPG.pwn(10043) : warning 225: unreachable code
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Are you straight copy pasting this to your script! Do not do that.

CTRL+ F and Enter 'OnPlayerKeyStateChange' and look for this callback.

Where ever you find it! Inside it. Write
pawn Код:
if (newkeys & KEY_FIRE) // You can also add more checks that TD is shown to the player or not!
    {
           TextDrawDestroy(textdrawname);//Change TextDraw Name here!
    }
    return 1;



Re: Textdraw - Mustafa6155 - 17.11.2012

sorry for copying but read me other edited reply please.


Re: Textdraw - B-Matt - 17.11.2012

Use this dude: https://sampwiki.blast.hk/wiki/TextDrawShowForPlayer
PHP код:
public OnPlayerText(playeridtext[])
{
   
TextDrawShowForPlayer(playeridtext)//text = textdraw id
    
return 0;




Re: Textdraw - Ballu Miaa - 17.11.2012

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{

    new string[128];
    if (newkeys == KEY_FIRE) // You can also add more checks that TD is shown to the player or not!
    {
            TextDrawDestroy(Textdraw0);//Change TextDraw Name here! this this
            TextDrawDestroy(Textdraw1);//Change TextDraw Name here! this this
            TextDrawDestroy(Textdraw2);//Change TextDraw Name here! this this
            TextDrawDestroy(Textdraw3);//Change TextDraw Name here! this this
            TextDrawDestroy(Textdraw4);//Change TextDraw Name here! this this
            TextDrawDestroy(Textdraw5);//Change TextDraw Name here! this this
            TextDrawDestroy(Textdraw6);//Change TextDraw Name here! this this
            TextDrawDestroy(Textdraw7);//Change TextDraw Name here! this this
            TextDrawDestroy(Textdraw8);//Change TextDraw Name here! this this
            TextDrawDestroy(Textdraw9);//Change TextDraw Name here! this this
            TextDrawDestroy(Textdraw10);//Change TextDraw Name here! this this
            return 1;
    }
    if(newkeys == KEY_LOOK_BEHIND) //Starting / Stoping vehicle engine
    {
        if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
        {
            new engine,lights,alarm,doors,bonnet,boot,objective;
            new vid = GetPlayerVehicleID(playerid);
            GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
            if(engine == VEHICLE_PARAMS_ON && !IsAPlane(vid) && !IsACycleBike(vid))
            {
                SpamStrings[playerid] +=2;
                if(SpamStrings[playerid] >= MAX_SPAM)
                {
                    SendClientMessage(playerid, COLOR_WHITE, "Please do not spam. Please wait before trying to turn on/off the engine again.");
                    return 0;
                }
                SetVehicleParamsEx(vid,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
                for(new i=0; i<MAX_PLAYERS; i++)
                {
                    if(GetDistanceBetweenPlayers(playerid,i) < 10)
                    {
                        format(string,sizeof(string),"%s(%d) spins the vehicle's engine key and turns off the engine.",PlayerName(playerid),playerid);
                        SendClientMessage(i,COLOR_LIGHTBLUE,string);
                    }
                }
                return 1;
            }
        if(engine != VEHICLE_PARAMS_ON && !IsAPlane(vid) && !IsACycleBike(vid))
            {
                SpamStrings[playerid] +=2;
                if(SpamStrings[playerid] >= MAX_SPAM)
                {
                    SendClientMessage(playerid, COLOR_WHITE, "Please do not spam. Please wait before trying to turn on/off the engine again.");
                    return 0;
                }
                SetVehicleParamsEx(vid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
                for(new i=0; i<MAX_PLAYERS; i++)
                {
                    if(GetDistanceBetweenPlayers(playerid,i) < 10)
                    {
                        format(string,sizeof(string),"%s(%d) spins the vehicle's engine key and turns on the engine.",PlayerName(playerid),playerid);
                        SendClientMessage(i,COLOR_LIGHTBLUE,string);
                    }
                }
                return 1;
            }
        }
        return 1;
    }

    if(newkeys & KEY_SECONDARY_ATTACK && PlayerToPoint(1.0, playerid, -1619.1694,689.5911,7.1875)) //SFPD Shutter Inside
    {
        if(gTeam[playerid] != TEAM_SWAT && gTeam[playerid] != TEAM_COP && gTeam[playerid] != TEAM_ARMY)
        {
            SendClientMessage(playerid,COLOR_WHITE,"{FF0000}[ERROR]: {FFFFFF}Access Denied");
            return 1;
        }
        SpamStrings[playerid] +=2;
        if(SpamStrings[playerid] >= MAX_SPAM)
        {
            SendClientMessage(playerid, COLOR_WHITE, "Please do not spam. Please wait before opening/closing again.");
            return 0;
        }
        SetPlayerPos(playerid, -1619.1694,689.5911,7.1875);
        SetPlayerFacingAngle(playerid, 269.9927);
        LoopingAnim(playerid, "HEIST9", "Use_SwipeCard", 3.0, 0, 0, 0, 0, 0);
        if(SFPDShutterOpen == 0)
        {
            MoveObject(SFPDShutter, -1620.61669922,688.17712402,12.80728531, 4);
            SendClientMessage(playerid, COLOR_DODGERBLUE, "Access Granted");
            SFPDShutterOpen =1;
            return 1;
        }
        if(SFPDShutterOpen == 1)
        {
            MoveObject(SFPDShutter, -1620.61669922,688.17712402,7.80728531, 4);
            SFPDShutterOpen =0;
            return 1;
        }
        return 1;
    }

    if(newkeys & KEY_SECONDARY_ATTACK && PlayerToPoint(1.0, playerid, -1622.1335,687.1992,7.1875)) //SFPD Shutter Outside
    {
        if(gTeam[playerid] != TEAM_SWAT && gTeam[playerid] != TEAM_COP && gTeam[playerid] != TEAM_ARMY)
        {
            SendClientMessage(playerid,COLOR_WHITE,"{FF0000}[ERROR]: {FFFFFF}Access Denied");
            return 1;
        }
        SpamStrings[playerid] +=2;
        if(SpamStrings[playerid] >= MAX_SPAM)
        {
            SendClientMessage(playerid, COLOR_WHITE, "Please do not spam. Please wait before opening/closing again.");
            return 0;
        }
        SetPlayerPos(playerid, -1622.1335,687.1992,7.1875);
        SetPlayerFacingAngle(playerid, 0.2336);
        LoopingAnim(playerid, "HEIST9", "Use_SwipeCard", 3.0, 0, 0, 0, 0, 0);
        if(SFPDShutterOpen == 0)
        {
            MoveObject(SFPDShutter, -1620.61669922,688.17712402,12.80728531, 4);
            SendClientMessage(playerid, COLOR_DODGERBLUE, "Access Granted");
            SFPDShutterOpen =1;
            return 1;
        }
        if(SFPDShutterOpen == 1)
        {
            MoveObject(SFPDShutter, -1620.61669922,688.17712402,7.80728531, 4);
            SFPDShutterOpen =0;
            return 1;
        }
        return 1;
    }

    if(newkeys & KEY_SECONDARY_ATTACK && PlayerToPoint(1.0, playerid, 245.3787,73.5715,1003.6406)) //FBI Shutter Inside
    {
        if(GetPlayerSkin(playerid) != 286)
        {
            SendClientMessage(playerid,COLOR_WHITE,"{FF0000}[ERROR]: {FFFFFF}Access Denied");
            return 1;
        }
        SpamStrings[playerid] +=2;
        if(SpamStrings[playerid] >= MAX_SPAM)
        {
            SendClientMessage(playerid, COLOR_WHITE, "Please do not spam. Please wait before opening/closing again.");
            return 0;
        }
        SetPlayerPos(playerid, 245.3787,73.5715,1003.6406);
        SetPlayerFacingAngle(playerid, 91.2136);
        LoopingAnim(playerid, "HEIST9", "Use_SwipeCard", 3.0, 0, 0, 0, 0, 0);
        if(FBIShutterOpen == 0)
        {
            MoveObject(FBIShutter, 246.42794800,72.70855713,1009.26043701, 3);
            SendClientMessage(playerid, COLOR_DODGERBLUE, "Access Granted");
            FBIShutterOpen =1;
            return 1;
        }
        if(FBIShutterOpen == 1)
        {
            MoveObject(FBIShutter, 246.42794800,72.70855713,1004.26043701, 3);
            FBIShutterOpen =0;
            return 1;
        }
        return 1;
    }

    if(newkeys & KEY_SECONDARY_ATTACK && PlayerToPoint(1.0, playerid, 247.7420,71.6222,1003.6406)) //FBI Shutter Outside
    {
        if(GetPlayerSkin(playerid) != 286)
        {
            SendClientMessage(playerid,COLOR_WHITE,"{FF0000}[ERROR]: {FFFFFF}Access Denied");
            return 1;
        }
        SpamStrings[playerid] +=2;
        if(SpamStrings[playerid] >= MAX_SPAM)
        {
            SendClientMessage(playerid, COLOR_WHITE, "Please do not spam. Please wait before opening/closing again.");
            return 0;
        }
        SetPlayerPos(playerid, 247.7420,71.6222,1003.6406);
        SetPlayerFacingAngle(playerid, 3.7928);
        LoopingAnim(playerid, "HEIST9", "Use_SwipeCard", 3.0, 0, 0, 0, 0, 0);
        if(FBIShutterOpen == 0)
        {
            MoveObject(FBIShutter, 246.42794800,72.70855713,1009.26043701, 3);
            SendClientMessage(playerid, COLOR_DODGERBLUE, "Access Granted");
            FBIShutterOpen =1;
            return 1;
        }
        if(FBIShutterOpen == 1)
        {
            MoveObject(FBIShutter, 246.42794800,72.70855713,1004.26043701, 3);
            FBIShutterOpen =0;
            return 1;
        }
        return 1;
    }
    return 1;
}



Re: Textdraw - Mustafa6155 - 17.11.2012

Thanks ballu mia.


Re: Textdraw - Mustafa6155 - 17.11.2012

how to make it with F6 and T in chat?


Re: Textdraw - Ballu Miaa - 17.11.2012

Only these keys can be detected by SA-MP if pressed!

The way you want to do it! It can only be done liike. Press T and Enter the number of skill you want.

Then you are required to make a player array. And make its value 1 when this menu is shown to him.
And check under OnPlayerText when this array for player is 1. Then The number enetered
pawn Код:
public OnPlayerText(playerid, text[])
{
   if(ViewingMenu[playerid] == 1)
   {
       new value = strval(text);
       if(value == 1)
       {
            //Do this
       }
    }
    return 0;
}