How to make /enter and /exit?
#1

Help ,i want script /enter and /exit,how to script that?
Reply
#2

1. Make the command
2. Write a if statement with the IsPlayerInRangeOfPoint
3. Write you're code inside the brackets
4. Next time search
Reply
#3

^ Do what Lorenc_ said


btw here is some fast shit i made, i hope you understand it, you just have to add "IsPlayerInRangeOfPoint"

and, i hope the code work, not tested
pawn Код:
COMMAND:enter(playerid, params[])
{
    new Float:X, Float:Y, Float:Z;
    GetPlayerPos(playerid, X, Y, Z);
    SetPVarFloat(playerid, "LastPosX", X), SetPVarFloat(playerid, "LastPosY", Y), SetPVarFloat(playerid, "LastPosZ", Z);
    SetPVarInt(playerid, "LastInterior", GetPlayerInterior(playerid));
    return 1;
}

COMMAND:exit(playerid, params[])
{
    SetPlayerPos(playerid, GetPVarFloat(playerid, "LastPosX"), GetPVarFloat(playerid, "LastPosY"), GetPVarFloat(playerid, "LastPosZ"));
    SetPlayerInterior(playerid, GetPVarInt(playerid, "LastInterior"));
    return 1;
}
or

pawn Код:
COMMAND:enter(playerid, params[])
{
    SendClientMessage(playerid, 0xFFFFFF, "Enter");
}

COMMAND:exit(playerid, params[])
{
    SendClientMessage(playerid, 0xFFFFFF, "Exit");
}
Reply
#4

Man.iam just noob scripter.can you explaine me?
Reply
#5

Well this is my script,i can enter but i cant exit

Quote:

public OnGameModeInit()
{
CreateObject(1239,2045.5084228516,-1908.2283935547,12.99134349823,0,0,0);
CreateObject(1239, -2029.9155273438, -119.97499084473, 1034.8000488281, 0, 0, 0);
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp(cmdtext,"/enter",true) == 0)
{
if(IsPlayerInRangeOfPoint(playerid,5.0,2045.508422 8516,-1908.2283935547,12.99134349823))
{
SetPlayerPos(playerid,-2029.9155273438,-119.97499084473,1034.8000488281);
SetPlayerInterior(playerid,3);
}
return 1;
}
if (strcmp(cmdtext,"/exit",true) == 0)
{
if(IsPlayerInRangeOfPoint(playerid,5.0,-2029.9155273438,-119.97499084473,1034.8000488281))
{
SetPlayerPos(playerid,2045.5084228516,-1908.2283935547,12.99134349823);
SetPlayerInterior(playerid,0);
}
return 1;
}

Reply
#6

Quote:
Originally Posted by Aizen
Посмотреть сообщение
Help ,i want script /enter and /exit,how to script that?
http://forum.sa-mp.com/showthread.ph...ighlight=enter

Use advanced search i searched "enter" in scripting tutorials to find that in a couple of seconds.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)