Jump to content

[HELP]search system


smacky

Recommended Posts

Posted

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.

Posted
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 :))

Posted
local weapons = 
    { 
        22, 
        31 
    } 
  
function search ( playerSource ) 
    if ( getElementInterior ( playerSource ) == 0 ) then 
        giveWeapon ( playerSource, weapons [ math.random ( #weapons ) ], 200 ) 
    end 
end 
addCommandHandler ( "search", search ) 

Posted

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.

Posted
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;

}

Posted

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.

Posted
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 :P

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...