AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [SOLVED] KillStreak, Deathmsg_event (https://forums.alliedmods.net/showthread.php?t=210019)

wangbochiang 03-05-2013 08:49

[SOLVED] KillStreak, Deathmsg_event
 
1 Attachment(s)
I made a killstreak record.
but It won't work, And I don't know why..
can someone help me check my code where I did wrong?
thanks is advance!!

new part:
PHP Code:

new kills[32] = {0,...}
new 
killstreakrecord[32] = {0,...}
new 
currentKS,KSrec

init part:
PHP Code:

register_event("DeathMsg","DeathMsg_event""a")
currentKS 0;
KSrec 0

Deathmsg_event part:
PHP Code:

public DeathMsg_event() {
    new 
killer_name[32], victim_name[32]
    
get_user_name(read_data(1),killer_name,31)
    
get_user_name(read_data(2),victim_name,31)
    new 
killer read_data(1)
    new 
victim read_data(2)

    
kills[killer] += 1;
    
kills[victim] = 0
    
    if (
kills[killer] > killstreakrecord[killer]) 
    {
        
killstreakrecord[killer] = kills[killer]; 
    }
    
currentKS kills[killer];
    
KSrec killstreakrecord[killer];
    
        
//debug
    
client_print(killer,print_chat,"[DEBUG] killstreak: %d killstreak Record: %d",kills[killer],killstreakrecord[killer]);
    
client_print(killer,print_chat,"[DEBUG] killstreak: %d killstreak Record: %d",currentKS,KSrec);
    return 
PLUGIN_CONTINUE;


When I test it even DEBUG msg is not apper.. where did i do wrong? thanks all the pros helping me...

sorry my bad english. ><



SOLVED:
I solved the problem myself.

wangbochiang 03-05-2013 11:06

Re: KillStreak, Deathmsg_event
 
BUMP
really need some Pro help me with this...

Kia 03-05-2013 11:20

Re: KillStreak, Deathmsg_event
 
1. You're only allowed to bump all 14 days.
2. %d -> %i

ConnorMcLeod 03-05-2013 11:46

Re: KillStreak, Deathmsg_event
 
Quote:

Originally Posted by Kia (Post 1907054)
2. %d -> %i

Wrong, %d is perfect.

wangbochiang 03-05-2013 11:47

Re: KillStreak, Deathmsg_event
 
Quote:

Originally Posted by Kia (Post 1907054)
1. You're only allowed to bump all 14 days.
2. %d -> %i

Sorry, I didn't notice the rules...

wangbochiang 03-05-2013 11:49

Re: KillStreak, Deathmsg_event
 
Quote:

Originally Posted by ConnorMcLeod (Post 1907073)
Wrong, %d is perfect.

I've see all the Plugins about "KillStreak" searching on forum.
but still can't realize where I did wrong..

Kia 03-05-2013 15:48

Re: KillStreak, Deathmsg_event
 
Quote:

Originally Posted by ConnorMcLeod (Post 1907073)
Wrong, %d is perfect.

Why? I thought you use %i for integers.

Arkshine 03-05-2013 16:01

Re: KillStreak, Deathmsg_event
 
in Pawn, %d and %i are the same, both are for integer values.

Arkshine 03-05-2013 17:14

Re: KillStreak, Deathmsg_event
 
wickedd, that's totally wrong. You can't put directly a string in as index, it doesn't make sense.
Please don't help if you don't know what you're doing, you will only confuse people.

Arkshine 03-05-2013 17:20

Re: KillStreak, Deathmsg_event
 
You advise : kills[killer_name] ; killer_name is a string. You can't do that. His original code is correct.


All times are GMT -4. The time now is 21:37.

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