SA-MP Forums Archive
[SOLVED]enum pInfo[][] transfer - 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: [SOLVED]enum pInfo[][] transfer (/showthread.php?tid=135942)



[SOLVED]enum pInfo[][] transfer - oggylt - 22.03.2010

Yes the suject i maybe confusing but i have problem with transfering data through filescripts, firstly i put that enum into .inc
i include taht .inc into my gm and race fs because when he is in
Код:
pInfo[playerid][DM]==1
to prevent using any commands, thats ok while in gm but he stil can use race commands , but i included the same include with enum data into booth files into FS and into GM and FS don't read any differences made by GM, can anyone help me with that thing?

sorry for bad engl;lish i hope you will understand what i mean


Re: enum pInfo[][] transfer - oggylt - 23.03.2010

bump


Re: enum pInfo[][] transfer - Kyosaur - 23.03.2010

Putting an enum/an array into an include and including it in mulitple filterscripts doesnt mean the data will change for all scripts when a fs changes its value. Basically, all your doing is declaring it all over again in all of your fs.

Use CallRemoteFunction to obtain/modify values in your other fs.


Re: enum pInfo[][] transfer - oggylt - 23.03.2010

i have never used call remote function can u give me an exampe please


Re: enum pInfo[][] transfer - Kyosaur - 23.03.2010

Sure i can.

This example is in my admin script.

Код:
// The callback HAS to be public, or there's no way CallRemoteFunction will work.

forward IsPlayerRegistered(playerid);
public IsPlayerRegistered(playerid)
{
	if(pData[playerid][IsRegistered] == true)
	{
	  if(pData[playerid][LoggedIn] == true) return 1;
	  return 0;
	}
	return -1;
}
It returns 1 if they are registered, and logged in; 0 if they are registered and not logged in; and -1 if they are not registered at all.

To check if a player is registered in another script, i use callremotefunction like so:

Код:
if(CallRemoteFunction("IsPlayerRegistered", "i", playerid) != -1)
Here's the wiki page for it's syntax: CallRemoteFunction




Re: enum pInfo[][] transfer - oggylt - 24.03.2010

i'm getting tag mismatch on callremotefuncion..
Код:
if(CallRemoteFunction("IsInNoCmdMode", "i", playerid)==true)
Код:
public IsInNoCmdMode(playerid)
{
	if(pInfo[playerid][DM]==1) return true;
	else if(pInfo[playerid][Jail]>0) return true;
	else if(pInfo[playerid][Freezed]==1) return true;
	else if(pInfo[playerid][Trucker]==1) return true;
	else return false;
 }
i read about it on wiki, thanks it will be very useful, what is wrong here i think something with integer or with else return...


Re: enum pInfo[][] transfer - oggylt - 26.03.2010

bump


Re: enum pInfo[][] transfer - Whitetiger - 26.03.2010

change
Код:
public IsInNoCmdMode(playerid)
{
	if(pInfo[playerid][DM]==1) return true;
	else if(pInfo[playerid][Jail]>0) return true;
	else if(pInfo[playerid][Freezed]==1) return true;
	else if(pInfo[playerid][Trucker]==1) return true;
	else return false;
 }
to
Код:
public IsInNoCmdMode(playerid)
{
	if(pInfo[playerid][DM] == 1 || pInfo[playerid][Jail] > 0 || (pInfo[playerid][Freezed] == 1 || (pInfo[playerid][Trucker] == 1) return 1;
	else return 0;
}
and change

Код:
if(CallRemoteFunction("IsInNoCmdMode", "i", playerid)==true)
to
Код:
if(CallRemoteFunction("IsInNoCmdMode", "i", playerid) == 1) //can't use true/false with CallRemoteFunction



Re: enum pInfo[][] transfer - oggylt - 26.03.2010

that works really thanks for both of you, this one is really useful


Re: enum pInfo[][] transfer - Norn - 27.03.2010

Quote:
Originally Posted by oggylt
that works really thanks for both of you, this one is really useful
Use pVar's now.