about CallRemoteFunction
#1

hey, sorry for my bad english
i have a question.. how can i get information from gamemode then i put then in filterscript , Someone say using CallRemoteFunction
example:
Код:
// In Gamemode
CMD:dm(playerid, params[])
{
	InDM[playerid] = 1;
	SendClientMessage(playerid, 0xFFFFFFFF, "You are in DM");
	return 1;
}
then the variable in gamemode want to put in filterscript

Код:
// In Filterscript
CMD:car(playerid, params[])
{
	if(InDM[playerid] == 1) return SendClientMessage(playerid, 0xFFFFFFFF, "You can't spawn car when in DM");
	return 1;
}
can someone explain ?
Reply
#2

You can use PVars to across variables like this between gamemodes and filterscripts.

https://sampwiki.blast.hk/wiki/Per-player_variable_system
Reply
#3

Quote:
Originally Posted by arakuta
Посмотреть сообщение
You can use PVars to across variables like this between gamemodes and filterscripts.

https://sampwiki.blast.hk/wiki/Per-player_variable_system
can you give me a exsample script?
Reply
#4

pawn Код:
CMD:dm(playerid, params[])
{
    SetPVarInt(playerid,"InDM",1);
    SendClientMessage(playerid, 0xFFFFFFFF, "You are in DM");
    return 1;
}
You can now use

pawn Код:
GetPVarInt(playerid,"InDM");
Anywhere.
Reply
#5

thanks, I will try +Rep
Reply
#6

hey, i've problem, How to make it to be a variable?
Ex
Код:
//in gamemode
CMD:dm(playerid, params[])
{
	SetPVarInt(playerid,"InDM",1);
	SendClientMessage(playerid, 0xFFFFFFFF, "You are in DM");
	return 1;
}
Код:
//in Filterscript
CMD:car(playerid, params[])
{
	GetPVarInt(playerid, "InDM");
	SendClientMessage(playerid, 0xFFFFFFFF, "you can't use cars when in DM");
	return 1;
}
Nothing Happned! :/ sorry i'm new on scripting
Reply
#7

You have to include it inside a condition, you'd be able to if you knew how if-else conditions work.

Example below:

pawn Код:
if(GetPVarInt(playerid, "InDM")) return SendClientMessage(playerid, 0xFFFFFFFF, "you can't use cars when in DM");


When you remove someone from the DM zone, simply use DeletePVar
Reply
#8

Quote:
Originally Posted by PaulDinam
Посмотреть сообщение
You have to include it inside a condition, you'd be able to if you knew how if-else conditions work.

Example below:

pawn Код:
if(GetPVarInt(playerid, "InDM")) return SendClientMessage(playerid, 0xFFFFFFFF, "you can't use cars when in DM");


When you remove someone from the DM zone, simply use DeletePVar
Thanks it work Perfecly,
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)