Set A variable in GM And Get In FS?
#1

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
Reply
#2

https://sampwiki.blast.hk/wiki/Per-player_variable_system

So

SetPVarInt(playerid, "pTeam", teamid);
and
GetPVarInt(playerid, "pTeam")
Reply
#3

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?
Reply
#4

use
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
Reply
#5

You hasn't set a PVar before using ...

pawn Код:
SetPVarInt(playerid,"Skill",1)
Reply
#6

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.
Reply
#7

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?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)