[SOLVED]enum pInfo[][] transfer
#1

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

bump
Reply
#3

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

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

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

Reply
#6

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

bump
Reply
#8

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
Reply
#9

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)