Killa_ Posted April 11, 2012 Author Share Posted April 11, 2012 How to make a single-use command?So if the player used a command like "/help" once-he cant use it second time? Link to comment Share on other sites More sharing options...
Ruins of Hell Posted April 11, 2012 Share Posted April 11, 2012 Can you give us some background? Why does this exist? Is it important that the player can only use it once (does it give them items)? Do you want to let them pass an argument to it (like /unlock 415623)? Once the player types it, can anyone else use it? Link to comment Share on other sites More sharing options...
Killa_ Posted April 11, 2012 Author Share Posted April 11, 2012 I want to make something like /unlock item and now i want 2 ways: everyone else can use it,but only once.Second way:first 10 players who activated the command gets an item. Link to comment Share on other sites More sharing options...
Killa_ Posted April 11, 2012 Author Share Posted April 11, 2012 In ModInput```Case "/ineedsomecakes" Call GiveInvItem(player_index, [item id], [item value]) Call AddText("You have got some cakes!", HelpColor)```But how to make it usable once? Link to comment Share on other sites More sharing options...
jcsnider Posted April 12, 2012 Share Posted April 12, 2012 One way to do it, although not the best way would be to do this.Find PlayerRec (server side of course) and add a variable for exampleGotCake as boolean 'This is a true/false variableThen replace your code with this….```Case "/ineedsomecakes" if player(player_index).GotCake = false then Call GiveInvItem(player_index, [item id], [item value]) Call AddText("You have got some cakes!", HelpColor) Player(player_index).GotCake = true end if``` Link to comment Share on other sites More sharing options...
Killa_ Posted April 12, 2012 Author Share Posted April 12, 2012 Ah,sure!Big thanks,why i didnt thought about that! Link to comment Share on other sites More sharing options...
Killa_ Posted April 12, 2012 Author Share Posted April 12, 2012 I cant get it work,idk what index should i use here.How to get index of player who types /command?And i get error if i try to make GotCake As Boolean server-sided Link to comment Share on other sites More sharing options...
Baron Posted April 14, 2012 Share Posted April 14, 2012 Killa_ when you add something to the playerrec, make sure it is as the end of the playerrec list of featuresyou also need to find the initialisation functions and add false as the standard value for it when a new player is created. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now