AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   2 things (https://forums.alliedmods.net/showthread.php?t=195498)

daniel46 09-08-2012 10:04

2 things
 
i have 3 questions

1 i have a shop with points and i want that if player that didnt was in the server will get x points i mean if he is not in the nvault

2 i build this code

PHP Code:

new armor get_user_armor(victim);
    new 
health get_user_health(victim);
    new 
szName[32];
    
get_user_name(victim,szName,31)

    if(
armor && cs_get_user_team(attacker) == CS_TEAM_T && DayActive)
    {
        
set_hudmessage(255000.010.2906.012.0)
        
show_hudmessage(attacker"Name: %s^nHealth: %d^nArmor: %d"szNamehealtharmor)
    }
    else if(
cs_get_user_team(attacker) == CS_TEAM_T && DayActive)
    {
        
set_hudmessage(255000.010.2906.012.0)
        
show_hudmessage(attacker"Name: %s^nHealth: %d"szNamehealth)
    }


its with ham take dmg and there is 1 thing i dont know how to do when i hit hemm its shows hes health but not the health with the -health i hited hemm how can i cout it to?

3 i have an jailbreak lr and i want if there is 1 terror and only 1 ct left and the terror won the duel so it will do alot of rings to hemm


thaks for who ever helps

jimaway 09-08-2012 11:00

Re: 2 things
 
if takedamage hook is pre:
get_user_health(victim) - damage
if takedamage hook is post:
get_user_health(victim)

dint really understand this:
Quote:

3 i have an jailbreak lr and i want if there is 1 terror and only 1 ct left and the terror won the duel so it will do alot of rings to hemm
but maybe this is what you want:
Code:

#define TE_BEAMCYLINDER            21      // Cylinder that expands to max radius over lifetime
// write_byte(TE_BEAMCYLINDER)
// write_coord(position.x)
// write_coord(position.y)
// write_coord(position.z)
// write_coord(axis.x)
// write_coord(axis.y)
// write_coord(axis.z)
// write_short(sprite index)
// write_byte(starting frame)
// write_byte(frame rate in 0.1's)
// write_byte(life in 0.1's)
// write_byte(line width in 0.1's)
// write_byte(noise amplitude in 0.01's)
// write_byte(red)
// write_byte(green)
// write_byte(blue)
// write_byte(brightness)
// write_byte(scroll speed in 0.1's)


daniel46 09-08-2012 11:46

Re: 2 things
 
1
i have a jailbreak points shop and i want if the user wasnt in the server yet and dont have points so he will get x points as i choose

2
could you give example?

3
i want if its the terror only the terror won and killed all the cts so he will get does rings because rings i know how to do

Liverwiz 09-08-2012 13:39

Re: 2 things
 
Quote:

Originally Posted by daniel46 (Post 1794323)
1
i have a jailbreak points shop and i want if the user wasnt in the server yet and dont have points so he will get x points as i choose

Here is a snippet of code from one of my plugins. Exactly what you're looking for. Hope this sends you on your way.

PHP Code:

    if(!nvault_lookup(g_vaultHandlesz_vaultKeydatacharsmax(data), timestamp))
    {
        
frags 0
        nvault_set
(g_vaultHandlesz_vaultKey"0")
        if(
get_pcvar_num(log_pcvar) == 1)
            
log_to_file(nVaultLogFile"[BKF] User %s (%s) is a new client and has been added to the vault."namesz_vaultKey)
    } 


daniel46 09-08-2012 14:57

Re: 2 things
 
thanks but what i write in data?

ColdWar 09-08-2012 15:07

Re: 2 things
 
Quote:

Originally Posted by Liverwiz (Post 1794419)
Here is a snippet of code from one of my plugins. Exactly what you're looking for. Hope this sends you on your way.

PHP Code:

    if(!nvault_lookup(g_vaultHandlesz_vaultKeydatacharsmax(data), timestamp))
    {
        
frags 0
        nvault_set
(g_vaultHandlesz_vaultKey"0")
        if(
get_pcvar_num(log_pcvar) == 1)
            
log_to_file(nVaultLogFile"[BKF] User %s (%s) is a new client and has been added to the vault."namesz_vaultKey)
    } 



What to write ? I need more explanation

Liverwiz 09-08-2012 16:01

Re: 2 things
 
Quote:

Originally Posted by daniel46 (Post 1794505)
thanks but what i write in data?

data is just a variable that would normally return the data that is stored in the vault.
This is what nvault.inc has to say.
Quote:

/* Looks up a vault value for full information
* Returns 0 if the entry is not found
*/
native nvault_lookup(vault, const key[], value[], maxlen, &timestamp);

What's to explain?

If there is no vault information, you set it to what you want.

daniel46 09-09-2012 07:55

Re: 2 things
 
Ok thanks and what about the 2 other things could you help me?

Liverwiz 09-09-2012 08:45

Re: 2 things
 
Quote:

Originally Posted by daniel46 (Post 1794245)
2 i build this code

PHP Code:

new armor get_user_armor(victim);
    new 
health get_user_health(victim);
    new 
szName[32];
    
get_user_name(victim,szName,31)

    if(
armor && cs_get_user_team(attacker) == CS_TEAM_T && DayActive)
    {
        
set_hudmessage(255000.010.2906.012.0)
        
show_hudmessage(attacker"Name: %s^nHealth: %d^nArmor: %d"szNamehealtharmor)
    }
    else if(
cs_get_user_team(attacker) == CS_TEAM_T && DayActive)
    {
        
set_hudmessage(255000.010.2906.012.0)
        
show_hudmessage(attacker"Name: %s^nHealth: %d"szNamehealth)
    }


its with ham take dmg and there is 1 thing i dont know how to do when i hit hemm its shows hes health but not the health with the -health i hited hemm how can i cout it to?

hook it as post
Code:

RegisterHam(Ham_TakeDamage, "player", "doneGotShotAfter", 1)

ColdWar 09-09-2012 09:19

Re: 2 things
 
Quote:

Originally Posted by Liverwiz (Post 1794559)
data is just a variable that would normally return the data that is stored in the vault.
This is what nvault.inc has to say.



What's to explain?

If there is no vault information, you set it to what you want.

Look, i use it on a shop.. When a player loses all his dollars/cash it returns 0 just az same.. so it works but if player retrys when he had 0 dollars before he still get it as like first time.. is there another ways?


All times are GMT -4. The time now is 08:13.

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