Set A variable in GM And Get In FS? -
Admigo - 28.04.2012
Heey all,
How can i make a variable that it set in gamemode and get in filterscript?
I want to detect the team of the player in a filterscript with:
Код:
gTeam[playerid]=TEAM_COP
How can i do that?
Thanks Admigo
Re: Set A variable in GM And Get In FS? -
MP2 - 28.04.2012
https://sampwiki.blast.hk/wiki/Per-player_variable_system
So
SetPVarInt(playerid, "pTeam", teamid);
and
GetPVarInt(playerid, "pTeam")
Re: Set A variable in GM And Get In FS? -
Admigo - 28.04.2012
I made a function when teams enter car its sendmessage test(so just for test but dont work)
Код:
if(newstate == PLAYER_STATE_DRIVER)
{
if(GetPVarInt(playerid,"Skill")==1)
{
SendClientMessage(playerid,COLOR_RED,"test");
return 1;
}
return 1;
}
But when i make this in a command it works fine:
Код:
if (strcmp("/mycommand", cmdtext, true, 10) == 0)
{
if(GetPVarInt(playerid,"Skill")==1)
{
SendClientMessage(playerid,COLOR_RED,"test");
return 1;
}
return 1;
}
Cant onplayerstatechange not detect the pvarint?
Re: Set A variable in GM And Get In FS? -
Rudy_ - 28.04.2012
use
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
Re: Set A variable in GM And Get In FS? -
ViniBorn - 28.04.2012
You hasn't set a PVar before using ...
pawn Код:
SetPVarInt(playerid,"Skill",1)
Re: Set A variable in GM And Get In FS? -
Admigo - 28.04.2012
Quote:
Originally Posted by Viniborn
You hasn't set a PVar before using ...
pawn Код:
SetPVarInt(playerid,"Skill",1)
|
I already setted in my gamemode.
I said the command works but the onplayerstatechange dont work.
Re: Set A variable in GM And Get In FS? -
Admigo - 28.04.2012
Fixed
I deleted this what gave the problem.
pawn Код:
if(newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
{
new string[256];
VehicleModel[playerid] = GetVehicleModel(GetPlayerVehicleID(playerid));
format(string,sizeof(string),"%s",VehicleNames[VehicleModel[playerid]-400]); //black
GameTextForPlayer(playerid,string,2000,1); //shows the text
return 1;
}
How can i still have this in my script but dont give this problem?