Raised This Month: $ Target: $400
 0% 

FakeClientCommand and cycle for


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Belial4444
Junior Member
Join Date: Mar 2011
Old 05-20-2011 , 06:33   FakeClientCommand and cycle for
Reply With Quote #1

Hello, I am new at scripting and I have ony annoying problem. I have written some simple team bonuses but they do not work correctly. This is the code of some bonuses:
Quote:
for(new i=1;i<=MaxClients;i++)
{
if(GetClientTeam(i)==2)
{
FakeClientCommand(i, "give rifle_m60");
FakeClientCommand(i, "give pipe_bomb");
}
}
This gives minigun and pipe bomb to survivors (game-left4dead2). The problem is that sometimes not all the survivors receive them and this happens randomly, some get some not. So I want to know what is the problem, it seems to me that this code is correct...

Last edited by Belial4444; 05-20-2011 at 06:38.
Belial4444 is offline
LeGone
Senior Member
Join Date: Dec 2006
Location: Germany
Old 05-20-2011 , 06:51   Re: FakeClientCommand and cycle for
Reply With Quote #2

Canīt you use GivePlayerItem(client, "rifle_m60"); ?

Like this:
Code:
for (new i = 1; i <= MaxClients; i++)
{
    if (IsClientConnected(i) && IsClientInGame(i) && IsPlayerAlive(i) && GetClientTeam(i) == 2)
    {
        GivePlayerItem(i, "rifle_m60");
        GivePlayerItem(i, "pipe_bomb");
    }
}
Or am I wrong ?
LeGone is offline
Belial4444
Junior Member
Join Date: Mar 2011
Old 05-20-2011 , 07:09   Re: FakeClientCommand and cycle for
Reply With Quote #3

I tried what you wrote but now only 2 or 3 of 10 survivors get weapons But thanks for trying to help.
Hm, very interestying, I have used these if conditions you have written and it seems that now everything works perfect Thanks for your help man.

Last edited by Belial4444; 05-20-2011 at 08:35.
Belial4444 is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 09:52.


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