Little help needed.
#1

Hey again,

I'm scripting with LA-RP and i wanted to know how i can make system like that.Only confident players can enter(drug dealer, weapon smuggles etc.)

I'm using this system do enter buildings. Example:
You need to press F to enter buildings.
Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
new string[256];

 if(newkeys == KEY_SECONDARY_ATTACK)
        if (IsPlayerInRangeOfPoint(playerid, 3,-179.1893,1133.1321,19.7422))
            {

                SetPlayerInterior(playerid, 0);
                SetPlayerPos(playerid,2306.8218,-16.1652,26.7496);
                SetPlayerFacingAngle(playerid, 268);
                GameTextForPlayer(playerid, "~w~Bank", 5000, 3);
            }
			else if(IsPlayerInRangeOfPoint(playerid, 3,2304.6860,-16.1385,26.7422))
            {// Fort Carson Panka vдlja

                SetPlayerInterior(playerid, 0);
                SetPlayerPos(playerid,-181.6577,1133.0253,19.7422);
                SetPlayerFacingAngle(playerid, 87);
                GameTextForPlayer(playerid, "~w~Los Santos", 5000, 3);
            }
I think i can do something with this, but i dont how to build it up right way. :P

Код:
			else if (GetPlayerState(i) == 1 && PlayerToPoint(2.0, i,2022.1492,-1108.7837,26.2031))
			{
				if(PlayerInfo[i][pMember] == 16 || PlayerInfo[i][pLeader] == 16)
				{
					GameTextForPlayer(i, "~g~Teretulemast,~n~~y~Siin on tддpakkumine :  ~r~Narkoдrikas~n~~w~Kirjuta /liitu kui sa soovid tддkohta vastu vдtta", 5000, 3);
				}
				else
				{
				    GameTextForPlayer(i, "~r~Staff only", 5000, 3);
				}
			}
Regards, Sturra.
Reply
#2

pawn Код:
else if (GetPlayerState(i) == 1 && PlayerToPoint(2.0, i,2022.1492,-1108.7837,26.2031))
            {
                if(PlayerInfo[i][pMember] == 16 || PlayerInfo[i][pLeader] == 16)
                {
                    GameTextForPlayer(i, "~g~Teretulemast,~n~~y~Siin on tддpakkumine :  ~r~Narkoдrikas~n~~w~Kirjuta /liitu kui sa soovid tддkohta vastu vдtta", 5000, 3);
                }
                else
                {
                    GameTextForPlayer(i, "~r~Staff only", 5000, 3);
                }
            }
Put that code into OnPlayerKeyStageChange.

Do never use PlayerToPoint to check if the player is near of a point. Simply use IsPlayerInRangeOfPoint. You can see that when you press KEY_SECONDARY_ATTACK (default: F), it checks if you are near of a point in a circle of 3.0. If you are need of that point (that is the position of Bank entrance), it enters you in the bank and show you "Bank" as GameTextForPlayer message.
To avoid anyone enter into the bank, for exemple, simply check, after checking if the player is in range of the point (entrace of bank for that example), if the player is Member or Leader of the faction, 16, for example.
pawn Код:
if(PlayerInfo[i][pMember] == 16 || PlayerInfo[i][pLeader] == 16)
                {
So you teleport him into the bank
pawn Код:
SetPlayerInterior(playerid, 0);
                SetPlayerPos(playerid,2306.8218,-16.1652,26.7496);
                SetPlayerFacingAngle(playerid, 268);
                GameTextForPlayer(playerid, "~w~Bank", 5000, 3);
and you
PHP код:
return 1
To stop the callback OnPlayerKeyStateChange here, because if you don't stop it, it'll continue reading the rest of the code, for nothing.
If The player is not part of the faction no°16, just Show him
pawn Код:
GameTextForPlayer(i, "~r~Staff only", 5000, 3);
I did a lot to make you understand, and i recognize I don't speak english well, but I hope it helped you a little.
Reply
#3

Quote:
Originally Posted by Varkoll
Посмотреть сообщение
pawn Код:
else if (GetPlayerState(i) == 1 && PlayerToPoint(2.0, i,2022.1492,-1108.7837,26.2031))
            {
                if(PlayerInfo[i][pMember] == 16 || PlayerInfo[i][pLeader] == 16)
                {
                    GameTextForPlayer(i, "~g~Teretulemast,~n~~y~Siin on tддpakkumine :  ~r~Narkoдrikas~n~~w~Kirjuta /liitu kui sa soovid tддkohta vastu vдtta", 5000, 3);
                }
                else
                {
                    GameTextForPlayer(i, "~r~Staff only", 5000, 3);
                }
            }
Put that code into OnPlayerKeyStageChange.

Do never use PlayerToPoint to check if the player is near of a point. Simply use IsPlayerInRangeOfPoint. You can see that when you press KEY_SECONDARY_ATTACK (default: F), it checks if you are near of a point in a circle of 3.0. If you are need of that point (that is the position of Bank entrance), it enters you in the bank and show you "Bank" as GameTextForPlayer message.
To avoid anyone enter into the bank, for exemple, simply check, after checking if the player is in range of the point (entrace of bank for that example), if the player is Member or Leader of the faction, 16, for example.
pawn Код:
if(PlayerInfo[i][pMember] == 16 || PlayerInfo[i][pLeader] == 16)
                {
So you teleport him into the bank
pawn Код:
SetPlayerInterior(playerid, 0);
                SetPlayerPos(playerid,2306.8218,-16.1652,26.7496);
                SetPlayerFacingAngle(playerid, 268);
                GameTextForPlayer(playerid, "~w~Bank", 5000, 3);
and you
PHP код:
return 1
To stop the callback OnPlayerKeyStateChange here, because if you don't stop it, it'll continue reading the rest of the code, for nothing.
If The player is not part of the faction no°16, just Show him
pawn Код:
GameTextForPlayer(i, "~r~Staff only", 5000, 3);
I did a lot to make you understand, and i recognize I don't speak english well, but I hope it helped you a little.
Very nice tutorial and thank you for you'r nice reply, but still i'm getting this error.
Код:
F:\Users\Kasutaja\Desktop\ServeriFailid\gamemodes\dlrp.pwn(47841) : error 017: undefined symbol "i"
F:\Users\Kasutaja\Desktop\ServeriFailid\gamemodes\dlrp.pwn(47843) : error 017: undefined symbol "i"
F:\Users\Kasutaja\Desktop\ServeriFailid\gamemodes\dlrp.pwn(47845) : error 017: undefined symbol "i"
F:\Users\Kasutaja\Desktop\ServeriFailid\gamemodes\dlrp.pwn(47849) : error 017: undefined symbol "i"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)