AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Help with native's (https://forums.alliedmods.net/showthread.php?t=182934)

Bilal Pro 04-15-2012 12:11

Help with native's
 
Hello there,

Im trying to make a JBshop but i dont know how i can get my jbcash into the jbshop so i have to use natives
But how?

Napoleon_be 04-15-2012 13:19

Re: Help with native's
 
PHP Code:

public plugin_natives()
{
    
register_library ("jbshop_cash")
    
register_native ("jbcash_get_user_cash""_get_cash")
    
register_native ("jbcash_set_user_cash""_set_cash")


PHP Code:

public _get_cash(pluginparams)
{
        return 
iCash[get_param(1)]
}
 
public 
_set_cash(pluginparams)
{
        new 
iPlayer get_param (1)
        
iCash[iPlayer] = max(0get_param(2))
        return 
iCash [iPlayer]



Bilal Pro 04-15-2012 13:22

Re: Help with native's
 
I mean for example: JBcash: %i

Inside the JBshop

Edit: thanks for the example, but i dont understand it as well

Napoleon_be 04-15-2012 13:25

Re: Help with native's
 
PHP Code:

new iCash[33]

register_event("DeathMsg""eDeath")
register_clcmd("say /cash""SayCash")

public 
eDeath() {
    
iCash[read_data(2)]++
}

public 
SayCash(id) {
    
client_print(idprint_chat"Your current cash: %i"iCash[id])



Bilal Pro 04-15-2012 13:28

Re: Help with native's
 
This is not what i ment, i have to explain it to u on a better style.

I want from my JBcash plugin a native to my JBshop and inside the JBshop theres a button where u can see ur current cash for example

Jailbreak Shop
Your JBcash: %i

1. weapons
2. grenades
3. knifes

But i dont know how

Napoleon_be 04-15-2012 13:47

Re: Help with native's
 
use formatex.

PHP Code:


new szTemp[500]
formatex(szTempcharsmax(szTemp), "Jailbreak Shop^n Your JBCash: %i"iCash[id])

new 
menu menu_create(szTemp"menu_handler")

menu_additem(menu"Weapons""1")
menu_additem(menu"Grenades""2")
menu_additem(menu"Knifes""3")

menu_display(idmenu


Bilal Pro 04-15-2012 13:59

Re: Help with native's
 
Lol, you still dont get it i got 2 plugins, JBcash and JBshop

How will i get the users JBcash in an other plugin?

Bilal Pro 04-15-2012 15:10

Re: Help with native's
 
I dont understand it :S

kapzz 04-15-2012 15:31

Re: Help with native's
 
maybe with xvars
http://forums.alliedmods.net/showthread.php?t=138880

Exolent[jNr] 04-15-2012 17:01

Re: Help with native's
 
Quote:

Originally Posted by kapzz (Post 1689859)

They don't work with arrays.


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

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