SA-MP Forums Archive
/gymenter /gymexit - 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: /gymenter /gymexit (/showthread.php?tid=231913)



/gymenter /gymexit - davelord - 26.02.2011

hey, i want two /enter and /exit commands:

so on the gym enter, i want a text to say : /gymenter
and on the gym exit, a text must say /gymexit

the commands are /gymenter & /gymexit

you can only type /gymenter or /gymexit when you are on the right spot to type it. if not it wont work

AddPlayerClass(0,320.2555,231.0873,889.5491,2.4040 ,0,0,0,0,0,0); // gym enter
AddPlayerClass(0,320.2745,232.1795,889.5491,177.26 91,0,0,0,0,0,0); // gym exit


Re: /gymenter /gymexit - MP2 - 26.02.2011

pawn Код:
if(IsPlayerInRangeOfPoint(playerid, 10, enterx, entery, enterz) // can enter
{
    SetPlayerPos(playerid, enterx, entery, enterz);
    return SetPlayerInterior(playerid, gyminterior);
}
if(IsPlayerInRangeOfPoint(playerid, 10, exitx, exity, exitz) // can exit
{
    SetPlayerPos(playerid, exitx, exity, exitz);
    return SetPlayerInterior(playerid, 0);
}
SendClientMessage(playerid, color, "You are not near the gym entrance or exit.");



Re: /gymenter /gymexit - Serbish - 26.02.2011

pawn Код:
// @ Top of the script:

new Gym_Enter;
new Gym_Exit;

// @ OnGameModeInit:

Gym_Enter = CreatePickup(1239, 23, 320.2555, 231.0873, 889.5491, 0);
Gym_Exit = CreatePickup(1239, 23, 320.2745, 232.1795, 889.5491, 0);

// @ OnPlayerPickUpPickup:

if(pickupid == Gym_Enter)
{
    GameTextForPlayer(playerid, "TYPE: /GYMENTER", 2000, 4);
}
else if(pickupid == Gym_Exit)
{
    GameTextForPlayer(playerid, "TYPE: /GYMEXIT", 2000, 4);
}

// @ OnPlayerCommandText:

if(strcmp(cmdtext, "/gymenter", true) == 0)
{
    if(IsPlayerInRangeOfPoint(playerid, 5, 320.2555, 231.0873, 889.5491))
    {
        SetPlayerPos(playerid, 320.2745, 232.1795, 889.5491);
        SetPlayerInterior(playerid, ???); // YOUR INTERIOR.
        return 1;
    }
}
if(strcmp(cmdtext, "/gymexit", true) == 0)
{
    if(IsPlayerInRangeOfPoint(playerid, 5, 320.2745, 232.1795, 889.5491))
    {
        SetPlayerPos(playerid, 320.2555, 231.0873, 889.5491);
        SetPlayerInterior(playerid, 0);
        return 1;
    }
}