AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Assigning ID in stock. (https://forums.alliedmods.net/showthread.php?t=282887)

Napoleon_be 05-20-2016 05:10

Assigning ID in stock.
 
Hi,

How do i assign an ID to a player in a stock?

for example, you create a new function using:
PHP Code:

register_clcmd("say""HandleSay"

PHP Code:

public HandleSay(id) {



How can i do the same thing in stock? Can i just assign it whenever i want?

PHP Code:

stock stockfunction(idarg1arg2) {




The code i currently have is this:
PHP Code:

stock RollTheDice(idpricevalue) {
    new 
dice random_num(16)
    new 
woncash dice value
    
new iCash cs_get_user_money(id)
    new 
payprice iCash price
    
    cs_set_user_money
(idpayprice)
    
cs_set_user_money(idiCash woncash)
    
    
ColorChat(idGREEN"[RTD]^1 You rolled a %i and won %i cash"dicewoncash)


but it's not working properly...

What it should do: Take the price money from current cash and add the total won money.

What it actually does: Only adds the total won money

Napoleon_be 05-20-2016 05:19

Re: Assigning ID in stock.
 
nvm, got it fixed by myself, working code:
PHP Code:

stock RollTheDice(idpricevalue) {
    new 
dice random_num(16)
    new 
woncash dice value
    
new iCash cs_get_user_money(id)
    new 
payprice iCash price
    
    cs_set_user_money
(idpayprice woncash)
    
    
ColorChat(idGREEN"[RTD]^1 You rolled a %i and won %i cash"dicewoncash)




All times are GMT -4. The time now is 18:38.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.