AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   How do I set a variable on someone I attacked? (https://forums.alliedmods.net/showthread.php?t=29347)

Rolnaaba 06-03-2006 22:54

How do I set a variable on someone I attacked?
 
how would I set
Code:
new bool:gotattacked[33]
on the person that got attacked
ex. say I shoot Mike how do I make it so when I shoot Mike I set gotattacked = true on Mike?, I know how to set it true/false on myself but not on others such as people you attacked.

v3x 06-04-2006 01:59

simple:
Code:
#include <amxmodx> public plugin_init() {   register_plugin("Got attacked" , "0.1" , "v3x");   register_event("ResetHUD" , "event_ResetHUD" , "b");   register_event("Damage" , "event_Damage" , "b" , "2>0"); } new bool:attacked[33]; public event_ResetHUD(id)   attacked[id] = false; public event_Damage(victim_id) // changed 'id' to 'victim_id' {   new attacker_id = get_user_attacker(victim_id);   if(!is_user_alive(attacker_id))     return PLUGIN_CONTINUE;   attacked[victim_id] = true;   return PLUGIN_CONTINUE; }

Rolnaaba 06-05-2006 10:13

if I said:
Code:
 new attacked attacked = read_data(1) client_print(attacked, print_chat, "You got attacked")
that would make the message go onto the person how got attacked right?
also putting:
Code:
new bool:gotattacked[33] new attacked attacked = read_data(1) gotattacked[attacked] = true
would set gotattacked true on the person getting shot right?

v3x 06-06-2006 05:12

No, that wouldn't work. Look at my code again, I updated it.

Rolnaaba 06-10-2006 11:10

ahh ok now I understand thank you very much :)


All times are GMT -4. The time now is 16:22.

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