SA-MP Forums Archive
2 Things - 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: 2 Things (/showthread.php?tid=332253)



2 Things - Trawltrawl - 07.04.2012

This is my last thread today, I'm not spamming or anything. :/

First question:

I've made 2 pickups, and in OnPlayerPickupPickUp(playerid, pickupid);
I've typed this
pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
    if(pickupid == PICKUP)
    {
    SendClientMessage(playerid, 0x00FF00AA, "You pickup'd an ak400! It respawns after death");
    GivePlayerWeapon(playerid, 30, 500);
    }
    return 1;
    if(pickupid == PICKUP2) // this is the line 266
    {
    SendClientMessage(playerid, 0x00FF00AA,"This is house1, type /enter_house1 to enter it!");
    }
    return 1;
}
How can i seperate them? Cause i got an warning that says
pawn Код:
C:\Users\User\Desktop\Scripting\gamemodes\wassim.pwn(266) : warning 225: unreachable code
That's my first question.


My Second question:

How Can I make ranks?
and how I can make people buy ranks?
Ex:
/buy rank
SetPlayerRank(playerid, 1);
If that's possible please tell me


-
Again, and again, I apologize for posting 2 threads today (less than 1 hour), so please ignore this, and help me!
Thanks
TrawlTrawl
Promise you, last one today(:


Re: 2 Things - Kindred - 07.04.2012

pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
    if(pickupid == PICKUP)
    {
        SendClientMessage(playerid, 0x00FF00AA, "You pickup'd an ak400! It respawns after death");
        GivePlayerWeapon(playerid, 30, 500);
    }
    if(pickupid == PICKUP2)
    {
        SendClientMessage(playerid, 0x00FF00AA,"This is house1, type /enter_house1 to enter it!");
    }
    return 1;
}
You had two return 1's in the same set of brackets, simply remove the farthest one to the top.

Also, you need to make a global variable or maybe an enumerator that can set ranks. And then you can create your own stocks for this. Of course, i won't be showing you, as I don't do this. Just wait for someone else to respond for the second question.


Re: 2 Things - BleverCastard - 07.04.2012

EDIT; Beat me to it.


Re: 2 Things - Trawltrawl - 07.04.2012

Damnit, how i've not seen that return D:
Oh, and thanks! (:


Re: 2 Things - BleverCastard - 07.04.2012

@Trawtrawl,

For the ranks
define like Rank1 and save it then use:
Код:
CMD:buyrank(playerid, params[])
{
       if(PlayerInfo[playerid][pRank1] ==0)
       {

       }
       else SendClientMessage(playerid,-1,"You are already Rank 1.");
}
Or something like that.


Re: 2 Things - Trawltrawl - 07.04.2012

Can you please tell me how do I define them?
or you mean
new rank1;
new rank2;?