AlliedModders

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

omgdpcwtf 11-15-2014 14:36

2 team together
 
Hi, I have little problem this code works wierd. If CTs wins and Im CT message showed, but if Im T and CTs wins message wont show me why? :(

Code:

public CounterTerrorists_win()
{
    new iPlayers[32], iNum, id
    get_players(iPlayers, iNum, "aceh", "CT")
    for(new i=0;i<iNum;i++) {
    set_dhudmessage(0, 255, 0, -1.0, 0.4, 2, 6.0, 2.0)
    show_dhudmessage(iPlayers[i], "WIN")
    client_cmd(iPlayers[i], "mp3 play ^"sound/mix/win.mp3^"")
    client_print(iPlayers[i], print_chat, "win!")
    }
   
    new iPlayers2[32], iNum2, id2
    get_players(iPlayers2, iNum2, "aceh", "TERRORIST")
    for(new i2=0;i2<iNum2;i2++) {
    set_dhudmessage(0, 255, 0, -1.0, 0.4, 2, 6.0, 2.0)
    show_dhudmessage(iPlayers[i2], "Loose!")
    client_cmd(iPlayers[i2], "mp3 play ^"sound/mix/loose.mp3^"")
    client_print(iPlayers[i2], print_chat, "LOOSE!")
    }
}


felipemilralze 11-15-2014 15:30

Re: 2 team together
 
I can not really understand

omgdpcwtf 11-15-2014 15:57

Re: 2 team together
 
If CTs wins and I play as CT I see hud message "You win" (this works)
If CTs wins and I play as T I dont see message "You lose" why? (this dont work)

HamletEagle 11-16-2014 04:57

Re: 2 team together
 
Quote:

Change "new id2" to "new i2".Bam! Code working!
Please don't give bad advices. Look into the for, he already do <new i2>

Code:
public CounterTerrorists_win() {     new iPlayers[32], iNum, id, i     get_players(iPlayers, iNum, "aceh", "CT")     for(i=0;i<iNum;i++)     {         id = iPlayers[i]         set_dhudmessage(0, 255, 0, -1.0, 0.4, 2, 6.0, 2.0)         show_dhudmessage(id, "WIN")         client_cmd(id, "mp3 play ^"sound/mix/win.mp3^"")         client_print(id, print_chat, "win!")     }     get_players(iPlayers, iNum, "aceh", "TERRORIST")     for(i=0;i<iNum;i++)     {         id = iPlayers[i]         set_dhudmessage(id, 255, 0, -1.0, 0.4, 2, 6.0, 2.0)         show_dhudmessage(id, "Loose!")         client_cmd(id, "mp3 play ^"sound/mix/loose.mp3^"")         client_print(id, print_chat, "LOOSE!")     } }

omgdpcwtf 11-16-2014 05:10

Re: 2 team together
 
it doesnt work...If Im T and CTs win I still dont see message...:(, I think problem will be maybe in flags "aceh"?

HamletEagle 11-16-2014 05:17

Re: 2 team together
 
AFAIK the flag h doesn't exists on get_players. Try the flags <ce>

omgdpcwtf 11-16-2014 05:24

Re: 2 team together
 
Boom works :) thanks bro, flags are not as easy as they seems, thank you

HamletEagle 11-16-2014 05:59

Re: 2 team together
 
Look into the wiki, you have the full explanation there.


All times are GMT -4. The time now is 17:34.

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