Using variable from another script...
#1

I have a filterscript where I have a specific car,
Код:
scar = AddStaticVehicle(xxx,0,0,0,0,0,180);
I have another FS where I want to check if people are getting into that car, because I want to limit the people that get in to two
Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
	if (ispassenger)
	{
		if (GetVehicleModel(vehicleid) == xxx)
		{
			if (vehicleid == scar && NinAS > 1)
			{
				SendClientMessage(playerid, COLOR_RED, "There are no open seats!");
			}
			else
			{
				//some irrelevant coding here...
				if (vehicleid == scar)
				{
					NinAS += 1;
				}
			}
		}
	}else
	{
		if (vehicleid == scar)
		{
			NinAS += 1;
		}
	}
	return 1;
}
Does this look right for what I want, and how do I get the vehicle id of "scar" from the first FS in the second?

Thanks a million,
Tony
Reply
#2

Quote:

Does this look right for what I want, and how do I get the vehicle id of "scar" from the first FS in the second?

well thats not possible that you get any FSs data from other FSs.
Reply
#3

Quote:
Originally Posted by _Saif_
Quote:

Does this look right for what I want, and how do I get the vehicle id of "scar" from the first FS in the second?

well thats not possible that you get any FSs data from other FSs.
that's completely incorrect, you can use CallRemoteFunction to get variables from other scripts.

https://sampwiki.blast.hk/wiki/CallRemoteFunction
Reply
#4

Quote:
Originally Posted by cessil
Quote:
Originally Posted by _Saif_
Quote:

Does this look right for what I want, and how do I get the vehicle id of "scar" from the first FS in the second?

well thats not possible that you get any FSs data from other FSs.
that's completely incorrect, you can use CallRemoteFunction to get variables from other scripts.

https://sampwiki.blast.hk/wiki/CallRemoteFunction
he doesnt save for file but he save for FS .
Reply
#5

Quote:
Originally Posted by _Saif_
he doesnt saif for file but he saif for FS .
Please make sense next time you post
Reply
#6

Quote:
Originally Posted by cessil
Quote:
Originally Posted by _Saif_
he doesnt saif for file but he saif for FS .
Please make sense next time you post
ahh listen me dude ,can you prove that someting that works in first FS should work in second FS.Show me something about it.
Reply
#7



this was in the "IsSaifWrong" filterscript
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/IsSaifWrong", cmdtext, true) == 0)
	{
		new string[128];
		format(string,sizeof(string),"returned variable is %d",CallRemoteFunction("SaifIsSoWrong","d","playerid"));
		SendClientMessage(playerid,0x33CCFFAA,string);
		return 1;
	}
	return 0;
}
this was in the "saifiswrong" filterscript
Код:
forward SaifIsSoWrong(string[]);
public SaifIsSoWrong(string[])
{
	new i;
	i = 500;
	return i;
}
next time you are unsure about a function, check it out yourself don't just say everyone else is wrong except you
Reply
#8

You can't directly get a variable from another script, but you can create a function which returns the variable, and call that with CallRemoteFunction. Essentially the same thing.

@cessil: lol, pwnt, but why do you have string[] as a parameter of SaifIsSoWrong?
Reply
#9

Quote:
Originally Posted by ev0lutionnn
You can't directly get a variable from another script, but you can create a function which returns the variable, and call that with CallRemoteFunction. Essentially the same thing.

@cessil: lol, pwnt, but why do you have string[] as a parameter of SaifIsSoWrong?
the same iam saying .
Reply
#10

You can create a variable "new boobs[MAXPLAYERS];" and use it in an include.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)