SA-MP Forums Archive
Need help with script.. [code on using /enter] - 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: Need help with script.. [code on using /enter] (/showthread.php?tid=84729)



Need help with script.. [code on using /enter] - Hiitch - 02.07.2009

Hello, I was scripting a place today, but I am having a little trouble, would anyone be able to tell me how I can make an /enter command so that if the player types it when he is not at the " I " icon that he cannot enter, where as if he was, he can enter?

//CODE

Код:
 	if(!strcmp("/Enter", cmdtext, true))
		{
	GameTextForPlayer(playerid, "~g~Welcome to Alhambra!",3500,5);
	SetPlayerInterior(playerid, 17);
	SetPlayerPos(playerid,493.5872,-22.6800,1000.6797);
	CreatePickup(1239,1, -1921.4227,564.1207,35.2072);
	return 1;
		}
Thanks in advance.


Re: Need help with script.. [code on using /enter] - refshal - 02.07.2009

What "I" Icon? Something on the map? If that icon is something that you're created, then show it.


Re: Need help with script.. [code on using /enter] - Yuryfury - 02.07.2009

There probably is a better way to do this through PayerToPoint but since you want to use the icon this should probably work:

pawn Код:
if(!strcmp("/Enter", cmdtext, true))
{
    new float:X, float:Y, float:Z;
    GetPlayerPos(playerid,X,Y,Z)
    if(X=-1921.4227 && Y=564.1207 && Z=35.2072)
    {
        GameTextForPlayer(playerid, "~g~Welcome to Alhambra!",3500,5);
        SetPlayerInterior(playerid, 17);
        SetPlayerPos(playerid,493.5872,-22.6800,1000.6797);
    }
    return 1;
}
IMPORTANT: put "CreatePickup(1239,1, -1921.4227,564.1207,35.2072);" under OnGamemodeInit not in the teleport itself.

you can also add an "else" error statement (i.e. SendClientMessage(playerid,COLOR,"You Are Not At The Marker!");


Re: Need help with script.. [code on using /enter] - Yuryfury - 02.07.2009

Quote:
Originally Posted by cοοp
What "I" Icon? Something on the map? If that icon is something that you're created, then show it.
He meant the pick-up
Quote:

CreatePickup(1239,1, -1921.4227,564.1207,35.2072);




Re: Need help with script.. [code on using /enter] - refshal - 02.07.2009

I guess that he meant "1" instead of "I". But whatever, now you've done it.


Re: Need help with script.. [code on using /enter] - Hiitch - 02.07.2009

Sorry, if you guys are unclear by what I mean, I meant the information icon.


Re: Need help with script.. [code on using /enter] - Yuryfury - 02.07.2009

Quote:
Originally Posted by Hiitch
Sorry, if you guys are unclear by what I mean, I meant the information icon.
yeah that is what I thought it was. BTW does it work?


Re: Need help with script.. [code on using /enter] - Hiitch - 02.07.2009

the way that it works is, when the player steps on it, he / she needs to type /enter to go to alhambra (interior 17). but when they type /enter, it doesnt matter where they are, they enter it anyways.


Re: Need help with script.. [code on using /enter] - Hiitch - 02.07.2009

and my bad, yeah it does work.