Using variable from another script... -
dracar - 16.03.2010
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
Re: Using variable from another script... -
Deat_Itself - 16.03.2010
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.
Re: Using variable from another script... -
cessil - 16.03.2010
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
Re: Using variable from another script... -
Deat_Itself - 16.03.2010
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 .
Re: Using variable from another script... -
cessil - 16.03.2010
Quote:
Originally Posted by _Saif_
he doesnt saif for file but he saif for FS .
|
Please make sense next time you post
Re: Using variable from another script... -
Deat_Itself - 16.03.2010
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.
Re: Using variable from another script... -
cessil - 16.03.2010
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
Re: Using variable from another script... -
ev0lution - 16.03.2010
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?
Re: Using variable from another script... -
Deat_Itself - 16.03.2010
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 .
Re: Using variable from another script... -
LVFDM - 16.03.2010
You can create a variable "new boobs[MAXPLAYERS];" and use it in an include.