[Tutorial] Menu Selection
#1

Menu Selection
Maybe you have ask.. How can I make a Menu Selection?
Something like this:


Well in this post i will show you, how you can do it for your own server.
In my example i will use Streamer
Download: https://sampforum.blast.hk/showthread.php?tid=102865
Streamer is needed to use:
pawn Код:
CreateDynamicCP(Float:x, Float:y, Float:z, Float:size, worldid = -1, interiorid = -1, playerid = -1, Float:distance = 100.0);
IsPlayerInDynamicCP(playerid, checkpointid);
To Install it, Add Streamer in you includes folder

The First that you need to do to begin is add the include to you GameMode/Filterscript like this:
pawn Код:
#include <streamer>
Create your textdraw.. create it like this:
First:
pawn Код:
new Text:TextDraw1;
Then:
pawn Код:
TextDraw1= TextDrawCreate(15.000000, 170.000000, "~n~~y~ Weapons:~n~~n~~y~1.~w~Chainsaw ~g~$5000~n~~y~2.~w~Desert ~g~$2500~n~~y~3.~w~Sawnoff ~g~$3500~n~~y~4.~w~Combat ~g~$5000~n~~y~5.~w~Tec9 ~g~$6000~n~~y~6.~w~MP5 ~g~$7500~n~~y~7.~w~M4 ~g~$8000~n~~y~8.~w~Sniper ~g~$10000~n~~y~9.~w~Armor ~g~$1000~n~");
TextDrawFont(TextDraw1, 1);
TextDrawTextSize(TextDraw1,145.000000, 260.000000);
TextDrawLetterSize(TextDraw1,0.299999,0.800000);
TextDrawUseBox(TextDraw1, 1);
TextDrawBoxColor(TextDraw1, 0x000000FF);
The TextDraw is Ready.

Now create the checkpoint:
First:
pawn Код:
new:Checkpoint1;
Then:
pawn Код:
public OnGameModeInit()
{
Checkpoint1= CreateDynamicCP (313.9218,-133.6192,999.6016, 1.5, -1, -1, -1, 7.0); // Checkpoint in the ammun nation
return 1;
}
Join and Verify that the checkpoints appear

If the checkpoint and the TextDraw are ready to use, you have to add this:

pawn Код:
public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
    if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
    {
            if(checkpointid == Checkpoint1) // This is what the checkpoint will do
            {
                TextDrawShowForPlayer(playerid, TextDraw1); // Funtion, in this case the checkpoint only will show the TextDraw
            }
        }
return 1;
}
When you are in the checkpoint, it must show you the textdraw that you made before.
If it isn't like that, you have to verify all that you did

Well, If everything is in order, you have to add this code:

pawn Код:
public OnPlayerText(playerid, text[])
{
    if(text[0] == '1') // Chainsaw
    if(IsPlayerInDynamicCP(playerid, Checkpoint1)) // This will work, only if you are in the checkpoint
    {
        if(GetPlayerMoney(playerid) <5000) return SendClientMessage(playerid,ROJO, "You Dont Have Enogh Money"); // if you do not have the specific money, it will say the "you dont have enough money"
        GivePlayerMoney(playerid,-5000); // The Weapon Cost
        GivePlayerWeapon(playerid,9,0);
    return 0;
    }
    if(text[0] == '2') //Desert Eagle
    if(IsPlayerInDynamicCP(playerid, Checkpoint1)) // This will work, only if you are in the checkpoint
    {
        if(GetPlayerMoney(playerid) <2500) return SendClientMessage(playerid,ROJO, "You Dont Have Enogh Money"); // if you do not have the specific money, it will say the "you dont have enough money"
        GivePlayerMoney(playerid,-2500); // The Weapon Cost
        GivePlayerWeapon(playerid,24,150);
    return 0;
    }
    if(text[0] == '3') //Sawnoff Shotgun
    if(IsPlayerInDynamicCP(playerid, Checkpoint1)) // This will work, only if you are in the checkpoint
    {
        if(GetPlayerMoney(playerid) <3500) return SendClientMessage(playerid,ROJO, "You Dont Have Enogh Money"); // if you do not have the specific money, it will say the "you dont have enough money"
        GivePlayerMoney(playerid,-3500); // The Weapon Cost
        GivePlayerWeapon(playerid,26,150);
    return 0;
    }
    if(text[0] == '4') //Combat Shotgun
    if(IsPlayerInDynamicCP(playerid, Checkpoint1)) // This will work, only if you are in the checkpoint
    {
        if(GetPlayerMoney(playerid) <5000) return SendClientMessage(playerid,ROJO, "You Dont Have Enogh Money"); // if you do not have the specific money, it will say the "you dont have enough money"
        GivePlayerMoney(playerid,-5000); // The Weapon Cost
        GivePlayerWeapon(playerid,27,150);
    return 0;
    }
    if(text[0] == '5') //Tec9
    if(IsPlayerInDynamicCP(playerid, Checkpoint1)) // This will work, only if you are in the checkpoint
    {
        if(GetPlayerMoney(playerid) <6000) return SendClientMessage(playerid,ROJO, "You Dont Have Enogh Money"); // if you do not have the specific money, it will say the "you dont have enough money"
        GivePlayerMoney(playerid,-6000); // The Weapon Cost
        GivePlayerWeapon(playerid,32,200);
    return 0;
    }
    if(text[0] == '6') //MP5
    if(IsPlayerInDynamicCP(playerid, Checkpoint1)) // This will work, only if you are in the checkpoint
    {
        if(GetPlayerMoney(playerid) <7500) return SendClientMessage(playerid,ROJO, "You Dont Have Enogh Money"); // if you do not have the specific money, it will say the "you dont have enough money"
        GivePlayerMoney(playerid,-7500); // The Weapon Cost
        GivePlayerWeapon(playerid,29,200);
    return 0;
    }
    if(text[0] == '7') //M4
    if(IsPlayerInDynamicCP(playerid, Checkpoint1)) // This will work, only if you are in the checkpoint
    {
        if(GetPlayerMoney(playerid) <8000) return SendClientMessage(playerid,ROJO, "You Dont Have Enogh Money"); // if you do not have the specific money, it will say the "you dont have enough money"
        GivePlayerMoney(playerid,-8000); // The Weapon Cost
        GivePlayerWeapon(playerid,31,250);
    return 0;
    }
    if(text[0] == '8') //Sniper
    if(IsPlayerInDynamicCP(playerid, Checkpoint1)) // This will work, only if you are in the checkpoint
    {
        if(GetPlayerMoney(playerid) <10000) return SendClientMessage(playerid,ROJO, "You Dont Have Enogh Money"); // if you do not have the specific money, it will say the "you dont have enough money"
        GivePlayerMoney(playerid,-10000); // The Weapon Cost
        GivePlayerWeapon(playerid,34,100);
    return 0;
    }
    if(text[0] == '9') //Armor
    if(IsPlayerInDynamicCP(playerid, Checkpoint1)) // This will work, only if you are in the checkpoint
    {
        if(GetPlayerMoney(playerid) <1000) return SendClientMessage(playerid,ROJO, "You Dont Have Enogh Money"); // if you do not have the specific money, it will say the "you dont have enough money"
        GivePlayerMoney(playerid,-1000); // The Weapon Cost
        SetPlayerArmour(playerid,100);
    return 0;
    }
    return 1;
}
If you arent in the checkpoint and you type the numbers, it will appear in the chat.

With this tutorial you can do the same but with diferents funtions, checkpoints and TextDraws.

Thats all.
Thanks You!
Reply
#2

why dont u use
pawn Код:
public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
    if(checkpointid == Checkpoint1)
    {....
instead of IsPlayerInDynamicCP(playerid, checkpointid);
Reply
#3

Two Words, Crazybob Ripoff.
Reply
#4

Quote:
Originally Posted by KyleSmith
Посмотреть сообщение
Two Words, Crazybob Ripoff.
And? O'well. I find this may be useful for people trying to learn to make store menus and such. Good job
Reply
#5

Hey mate,i have problem with your script :/
The problem is this: On first all is fine without errors or something,but when i go ingame and go in CheckPoint textdraw dont appear,and i can buy weapons.Just that textdraw dont appear..

What is problem does anyone know's i Use Raven 2.8
Reply
#6

Quote:
Originally Posted by KyleSmith
Посмотреть сообщение
Two Words, Crazybob Ripoff.
Two Words, Who Cares.

He done ripped of many people.
Reply
#7

can anyone help me ppl pls ?
Reply
#8

Quote:
Originally Posted by Equilibrium
Посмотреть сообщение
can anyone help me ppl pls ?
please paste what you scripted for the checkpoint, and if anything is missing ill try to help.
Reply
#9

Very nice tut
Reply
#10

I dont need help anymore,thanks

btw not bad tut
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)