SA-MP Forums Archive
about CallRemoteFunction - 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)
+--- Thread: about CallRemoteFunction (/showthread.php?tid=563890)



about CallRemoteFunction - Genmetal - 18.02.2015

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 ?


Re: about CallRemoteFunction - arakuta - 18.02.2015

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

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


Re: about CallRemoteFunction - Genmetal - 18.02.2015

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?


Re: about CallRemoteFunction - arakuta - 18.02.2015

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.


Re: about CallRemoteFunction - Genmetal - 18.02.2015

thanks, I will try +Rep


Re: about CallRemoteFunction - Genmetal - 18.02.2015

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


Re: about CallRemoteFunction - PaulDinam - 18.02.2015

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


Re: about CallRemoteFunction - Genmetal - 18.02.2015

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,