AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   How to use cs_get_user_team() and what is the name of a player entity?(ALMOST SOLVED) (https://forums.alliedmods.net/showthread.php?t=75445)

Dores 08-05-2008 17:44

How to use cs_get_user_team() and what is the name of a player entity?(ALMOST SOLVED)
 
1. How can I use the cs_get_user_team() function?(SOLVED)
I have tried doing the following:
PHP Code:

new CsInternalModel:PlrModel;
 
public 
my_func(id)
{
        new 
Team cs_get_user_team(idPlrModel);
        
// My code here...
        // bla bla bla....


But when I try to compile it says:
Code:

Warning: Tag mismatch on line 1080
(SOLVED)

2. What is the name of the player entitiy?(SOLVED)
For example, if I wanna use the FM_SetModel() function, that its parameters are:
Code:

FM_SetModel(ent, const szModel[])
What do I need to type in the "ent" parameter to get a player? (Problem solved, thanks to Peoples Army)

3. I am working on a basic plugin, and there are WAY too many lines in it for a plugin that does something that basic (setting up player's health, money and armor) and I just wanted to know the ways to make less lines and save memory... and causing less laggs... etc.

Thanks alot for any helpers!:up: (+karma of course)

Peoples Army 08-05-2008 18:15

Re: How to set up a player's model and how is the player entity called?
 
ent is the index of an entity , a player is an entity , so the players index number would be used .

Dores 08-05-2008 19:00

Re: How to set up a player's model and how is the player entity called?
 
Quote:

Originally Posted by Peoples Army (Post 665202)
ent is the index of an entity , a player is an entity , so the players index number would be used .

Ok, thanks alot. Now could you please try to answer my new question? I edited the main post. +karma

Peoples Army 08-05-2008 19:27

Re: How to use cs_get_user_team() and what is the name of a player entity?
 
the 2nd paramater of get_user_team is a string

Code:


new StoreTeamValue[32];

so you would use an array instead of a varaible , cuase your storing charchters , not a single digit or value

Dores 08-05-2008 19:33

Re: How to use cs_get_user_team() and what is the name of a player entity?
 
Quote:

Originally Posted by Peoples Army (Post 665233)
the 2nd paramater of get_user_team is a string

Code:


new StoreTeamValue[32];

so you would use an array instead of a varaible , cuase your storing charchters , not a single digit or value

Thanks alot, though I managed to handle by simply using the fun module's function:
PHP Code:

get_user_team() //Instead of:
cs_get_user_team()    //Of cstrike module... 

But still thanks alot for the help! I +karma you...:up:

Problem SOLVED but, I will let you know if there are any problems, so be ready to help me if I need, ok? :D

Peoples Army 08-05-2008 19:35

Re: How to use cs_get_user_team() and what is the name of a player entity?
 
lol np . K:mrgreen:

XxAvalanchexX 08-05-2008 21:43

Re: How to use cs_get_user_team() and what is the name of a player entity?
 
cs_get_user_team returns as "CsTeams", so declare the variable like "new CsTeams:Team". Then you have to set or check it using CS_TEAM_T, CS_TEAM_CT, etcetera. Or, you could use a regular variable, and convert the return result into an int: "new Team = _:cs_get_user_team(player)"

Peoples Army: The second argument to get_user_team is optional, it lets you get the team name (in addition to get_user_team returning the team number).

Peoples Army 08-05-2008 21:45

Re: How to use cs_get_user_team() and what is the name of a player entity?
 
oh thats right , i just saw him using the 2nd paramater so i figured id tell him how to use it right

Vet 08-05-2008 21:46

Re: How to use cs_get_user_team() and what is the name of a player entity?
 
Or the fakemeta way...
new team = pev(id, pev_team)

Dores 08-05-2008 23:26

Re: How to use cs_get_user_team() and what is the name of a player entity?
 
Quote:

Originally Posted by XxAvalanchexX (Post 665270)
cs_get_user_team returns as "CsTeams", so declare the variable like "new CsTeams:Team". Then you have to set or check it using CS_TEAM_T, CS_TEAM_CT, etcetera. Or, you could use a regular variable, and convert the return result into an int: "new Team = _:cs_get_user_team(player)"

Peoples Army: The second argument to get_user_team is optional, it lets you get the team name (in addition to get_user_team returning the team number).

What do you mean the second argument is optional? I couldn't use cs_get_user_team() without it. :O
And besides, I wanted it to return the team's NAME not NUMBER.
So I did needed to use the second argument?
And where do I need to put Team after i did new CsTeams:Team in the get_user_team function?
by the way, to set its team, do i need to do this: new CsTeams:Team = CS_TEAM...?

Peoples Army: Thanks for the karma:D

Vet: I think i'll use that just incase issues might pop up using the fun/cstrike module... +karma :)


All times are GMT -4. The time now is 05:40.

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