smacky Posted July 2, 2012 Share Posted July 2, 2012 Okay I decided to make /search system. When player enter in shop and he type /search, than he will find weapons or items, but i want to make it as random, is there any function like "RANDOM" script? I can't find anything like this in wiki if you know how I can make random things please tell me. Link to comment
Castillo Posted July 2, 2012 Share Posted July 2, 2012 Make a table and use: math.random Topic moved to "Scripting" section. Link to comment
smacky Posted July 2, 2012 Author Share Posted July 2, 2012 function search ( playerSource ) if ( getElementInterior(playerSource) == 0 ) then outputChatBox ( "გილოცავთ, თქვენ იპოვეთ M4" .. getPlayerName(playerSource), playerSource ) giveWeapon ( playerSource, 31, 200 ) else outputChatBox ( "თქვენ არ ხართ 24/7ში ან ნებისმიერ ინტერიერში." .. getPlayerName(playerSource), playerSource ) end end addCommandHandler ( "search", search ) Agr-, I tried my best but can't do anything, can you add that Math.Rand in this script? I'll take your lesson and I'll use it everytime ) Link to comment
Castillo Posted July 2, 2012 Share Posted July 2, 2012 local weapons = { 22, 31 } function search ( playerSource ) if ( getElementInterior ( playerSource ) == 0 ) then giveWeapon ( playerSource, weapons [ math.random ( #weapons ) ], 200 ) end end addCommandHandler ( "search", search ) Link to comment
smacky Posted July 2, 2012 Author Share Posted July 2, 2012 Oh.. If you can tell me any idea how I can script Item system please tell me, I mean when player find Cheeseburger in shop he will have it and when he will type /eat he will eat it... If you have any idea of this please tell me, thank you again. Link to comment
Castillo Posted July 2, 2012 Share Posted July 2, 2012 I don't want to sound rude, but maybe you should start with easier scripts. Link to comment
smacky Posted July 2, 2012 Author Share Posted July 2, 2012 I don't want to sound rude, but maybe you should start with easier scripts. Uhm-, it's simple I guess, I'll take simple thing, if zombie hit you and you're infected I know this in SAMP but I don't know how to code it here, when you're infected and you write /inject medicinb you'll not be infected anymore, CODE LIKE: if (playerid, infected == 1) { infected = 0 (Something like that.) return 1; } Link to comment
Castillo Posted July 2, 2012 Share Posted July 2, 2012 You can use element data to save the "infected" status. And for the event which would set the "infected" data, it could be: onPlayerDamage, although I'm not sure if zombies will trigger this event when damage you. Link to comment
smacky Posted July 2, 2012 Author Share Posted July 2, 2012 You can use element data to save the "infected" status.And for the event which would set the "infected" data, it could be: onPlayerDamage, although I'm not sure if zombies will trigger this event when damage you. Okay thank you very much, I did it Link to comment
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