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



Scripting /enter! - JackB - 16.02.2012

Hello guys. I got few questions. I would be very heppy if you help me .
1) I scripted new Hospital at Bayside and added "heart" icon. I would like when player go through it to enter automatically inside the building (I mean to do not need to press /enter). My whole script is on the bottom of the thread so you can easily modify and check it.
2) I would like to add a admin nick system. I mean when admin type /turn and chose appear in the admin list, he must enter nickname that will be showed in /admins like that:
((You type /admins))
______________________________________________
ADMINS ONLINE:
[ONLINE:] Lead Administrator (PhoeNiX): Terell Banks [ID: 1]

I colored that I want in red just to understand for what I'm talking about, really I don't want to be red in game/I don't want to be scripted in red color.

And that are my questions. I would be glad if you explain me what kind of script I must enter and where for 1) (Adding automatically /enter ...) If it is not possible to enter automatically in buildings I will be happy if you just explain me how to make it when player go over the icon to show him: Type /enter to enter inside the building and when he type it to enter.
Thank you all in advance guys.
Best Regards
http://www.mediafire.com/?7brnn11vx25kisp


Re: Scripting /enter! - MP2 - 16.02.2012

Use OnPlayerPickUpPickup.


Re: Scripting /enter! - Twisted_Insane - 16.02.2012

And "IsPlayerInRangeOfPoint"!


Re: Scripting /enter! - MP2 - 16.02.2012

Why would you need to use that? Obviously they're at the pickup if they picked it up ._.


Re: Scripting /enter! - JackB - 16.02.2012

Excuse me guys but I forgot to say that I'm beginner, may you please give me example and I forgot to upload my script now is edited.


Re: Scripting /enter! - JackB - 16.02.2012

Can someone help me? I'll really appreciate it.


Re: Scripting /enter! - ReneG - 16.02.2012

Example.
pawn Код:
new hospitalpickup;
public OnGameModeInit()
{
    hospitalpickup = CreatePickup(model,type,x,y,z,virtualworld);
    return 1;
}
public OnPlayerPickUpPickup(playerid,pickupid)
{
    if(pickupid == hospitalpickup)
    {
        SetPlayerPos(playerid,x,y,z);
    }
}
================================================== =====
Defines a new variable that will later hold the pickup.
pawn Код:
new hospitalpickup;
Creates the pickup, and assigns the variable to that pickup.
pawn Код:
public OnGameModeInit()
{
    hospitalpickup = CreatePickup(model,type,x,y,z,virtualworld);
    return 1;
}
This part states that if a player picks up that pickup, then it will SetPlayerPos which is where you would put your coordinates.
pawn Код:
public OnPlayerPickUpPickup(playerid,pickupid)
{
    if(pickupid == hospitalpickup)
    {
        SetPlayerPos(playerid,x,y,z);
    }
}
Hope I helped.


Re: Scripting /enter! - MP2 - 16.02.2012

^

For multiple pickups:

pawn Код:
public OnPlayerPickUpPickup(playerid,pickupid)
{
    if(pickupid == hospitalpickup)
    {
        SetPlayerPos(playerid,x,y,z);
    }
    else if(pickupid == someotherpickup)
    {
        SetPlayerPos(playerid, x, y, z);
    }
}



Re: Scripting /enter! - JackB - 16.02.2012

Thank you very much everyone. You helped me a lot.


Re: Scripting /enter! - M.Wilson - 16.02.2012

good luck with your server tho.