Raised This Month: $32 Target: $400
 8% 

Help with a code


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
BraveFox
AlliedModders Donor
Join Date: May 2015
Location: Israel
Old 05-18-2016 , 10:18   Help with a code
Reply With Quote #1

Hey,
I am trying to use "TF2_RemoveAllWeapons" with the "TFTeam_Red" "TF2_RemoveAllWeapons(TFTeam_Red);" and I got warning:"plugin.sp(46) : warning 213: tag mismatch"
I did "#include <tf2>" and "#include <tf2_stocks>" and in the tf2 funcations there is the TFTeam_Red funcation please help!
thx.
The TFTeam_Red funcation:
https://sm.alliedmods.net/new-api/tf2/TFTeam
__________________
Contact Me:
Steam: NoyB
Discord: Noy#9999
Taking Private Requests

Last edited by asherkin; 10-25-2018 at 17:24. Reason: Restore to previous version.
BraveFox is offline
Farbror Godis
AlliedModders Donor
Join Date: Feb 2016
Old 05-18-2016 , 10:31   Re: Help with a code
Reply With Quote #2

PHP Code:
for(int i 1<= MaxClientsi++) {
    if(
IsClientInGame(i) && IsPlayerAlive(i) && (GetClientTeam(i) == view_as<int>(TFTeam_Red)) {
        
TF2_RemoveAllWeapons(i);
    }

The function takes a client index, not a team index. Also, TFTeam is an enum, not an integer.

Last edited by Farbror Godis; 05-18-2016 at 10:43.
Farbror Godis is offline
BraveFox
AlliedModders Donor
Join Date: May 2015
Location: Israel
Old 05-18-2016 , 10:37   Re: Help with a code
Reply With Quote #3

Quote:
Originally Posted by Farbror Godis View Post
PHP Code:
for(int i 1<= MaxClientsi++) {
    if(
IsClientInGame(i) && (GetClientTeam(i) == view_as<int>(TFTeam_Red)) {
        
TF2_RemoveAllWeapons(i);
    }

The function takes a client index, not a team index. Also, TFTeam is an enum, not an integer.
I want to remove team weapons.
How can I do this?
__________________
Contact Me:
Steam: NoyB
Discord: Noy#9999
Taking Private Requests
BraveFox is offline
Farbror Godis
AlliedModders Donor
Join Date: Feb 2016
Old 05-18-2016 , 10:39   Re: Help with a code
Reply With Quote #4

The snippet in my reply is what you want.
Farbror Godis is offline
BraveFox
AlliedModders Donor
Join Date: May 2015
Location: Israel
Old 05-18-2016 , 10:44   Re: Help with a code
Reply With Quote #5

Quote:
Originally Posted by Farbror Godis View Post
The snippet in my reply is what you want.
I got error
plugin.sp(47) : error 028: invalid subscript (not an array or too many subscripts): "TFTeam_Red"
__________________
Contact Me:
Steam: NoyB
Discord: Noy#9999
Taking Private Requests
BraveFox is offline
Requiesta
Senior Member
Join Date: May 2012
Location: Texas
Old 05-18-2016 , 10:55   Re: Help with a code
Reply With Quote #6

Quote:
Originally Posted by BraveFox View Post
I got error
plugin.sp(47) : error 028: invalid subscript (not an array or too many subscripts): "TFTeam_Red"
Take the code given and replace view_as<int>(TFTeam_Red) with _:TFTeam_Red and try that.
__________________
YouTuber, Modder, Accountant, and somehow I still enjoy programming after all that.

Check out my YouTube Channel.
Requiesta is offline
BraveFox
AlliedModders Donor
Join Date: May 2015
Location: Israel
Old 05-18-2016 , 11:05   Re: Help with a code
Reply With Quote #7

Quote:
Originally Posted by Requiesta View Post
Take the code given and replace view_as<int>(TFTeam_Red) with _:TFTeam_Red and try that.
same
__________________
Contact Me:
Steam: NoyB
Discord: Noy#9999
Taking Private Requests
BraveFox is offline
Farbror Godis
AlliedModders Donor
Join Date: Feb 2016
Old 05-18-2016 , 12:18   Re: Help with a code
Reply With Quote #8

There's a missing ")" on that line.
Farbror Godis is offline
Chaosxk
Veteran Member
Join Date: Aug 2010
Location: Westeros
Old 05-18-2016 , 13:05   Re: Help with a code
Reply With Quote #9

Since your using TF2_RemoveAllWeapons which is part of tf2_stocks, you might as well use TF2_GetClientTeam so you don't need to do view_as<int>.
__________________
Chaosxk is offline
BraveFox
AlliedModders Donor
Join Date: May 2015
Location: Israel
Old 05-19-2016 , 00:08   Re: Help with a code
Reply With Quote #10

Quote:
Originally Posted by chaosxk View Post
since your using tf2_removeallweapons which is part of tf2_stocks, you might as well use tf2_getclientteam so you don't need to do view_as<int>.
i don't want to get client team i want it automatic be on red team
__________________
Contact Me:
Steam: NoyB
Discord: Noy#9999
Taking Private Requests
BraveFox 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 17:20.


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