Filterscript + Script, Possible to combine?
#1

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

copy & paste?
Reply
#3

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

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

Thnx for quick replys

Could I use this for VIP?
Reply
#6

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);
}
Reply
#7

thnx, this really helped me!
Reply
#8

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

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

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;
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)