SA-MP Forums Archive
Filterscript + Script, Possible to combine? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Filterscript + Script, Possible to combine? (/showthread.php?tid=112865)



Filterscript + Script, Possible to combine? - Tigerbeast11 - 10.12.2009

I want to be able to use stuff like:

pawn Код:
if(PlayerInfo[playerid][Muted] == 1)
in my own script without having to define it again. So, I have:

pawn Код:
enum Playerinfo[playerid]
{
Muted,

Blah Blah
In my filterscript


How can I use that in my gamemode?


Re: Filterscript + Script, Possible to combine? - Rzzr - 10.12.2009

copy & paste?


Re: Filterscript + Script, Possible to combine? - Mikep. - 10.12.2009

The only way to link a filterscript and gamemode is with CallRemoteFunction.


Re: Filterscript + Script, Possible to combine? - Correlli - 10.12.2009

In your filterscript:
pawn Код:
forward _IsPlayerMuted(playerid);

public _IsPlayerMuted(playerid)
{
  if(IsPlayerConnected(playerid))
  {
    if(PlayerInfo[playerid][Muted] == 1) return true;
    return false;
  }
  return false;
}
In your gamemode:
pawn Код:
stock IsPlayerMuted(playerid)
{
  CallRemoteFunction("_IsPlayerMuted", "i", playerid);
}
I got this from my head, i haven't tested it.


Re: Filterscript + Script, Possible to combine? - Tigerbeast11 - 10.12.2009

Thnx for quick replys

Could I use this for VIP?


Re: Filterscript + Script, Possible to combine? - Correlli - 10.12.2009

You could, it's the same as the example i gave you before.

In your filterscript:
pawn Код:
forward _IsPlayerVIP(playerid);

public _IsPlayerVIP(playerid)
{
  if(IsPlayerConnected(playerid))
  {
    // or whatever you use to check if player is VIP.
    if(PlayerInfo[playerid][VIP] == 1) return true;
    return false;
  }
  return false;
}
In your gamemode:
pawn Код:
stock IsPlayerVIP(playerid)
{
  CallRemoteFunction("_IsPlayerVIP", "i", playerid);
}



Re: Filterscript + Script, Possible to combine? - Tigerbeast11 - 10.12.2009

thnx, this really helped me!


Re: Filterscript + Script, Possible to combine? - Correlli - 10.12.2009

You're welcome - i hope the code worked, like i said, i didn't had time to test it.


Re: Filterscript + Script, Possible to combine? - Tigerbeast11 - 10.12.2009

BTW, after doing all that, what will I have to write to check if player is a vip.

For example, how would i give a vip Armour on player spawn.

pawn Код:
public OnPlayerSpawn(playerid)
{
...
return 1;
}
Plz fill out the ...


Re: Filterscript + Script, Possible to combine? - Correlli - 10.12.2009

pawn Код:
public OnPlayerSpawn(playerid)
{
  if(IsPlayerVIP(playerid))
  {
    // player is V.I.P, do whatever you want to do.
  }
  else
  {
    // player ISN'T V.I.P, do whatever you want to do.
  }
  return 1;
}