Jump to content
Sign in to follow this  
Llano

"Generic error mesage" at if-statment

Recommended Posts

Hello!

Time for a new problem.. again :)

init.sqf

onPlayerConnected "[_id, _name] execVM ""PlayerCheck.sqf""";

PlayerCheck.sqf

_name = _this select 1;
_uid = _this select 0;

_clientId = -1;
_cycles = 0;

while{_clientId == -1}do
{
 {
    if (getPlayerUID _x == _uid) exitWith
    {
       _clientId = owner _x;
	hint ("Arma2Net.Unmanaged" callExtension format ["SQLstats [pGUID, '%1']", _clientID]);
	hint format["id: %1", _clientID];
    };
 } forEach playableUnits;  
 _cycles = _cycles + 1;
 sleep .02;
};

When i run the mission, i'm getting error at line 10 in PlayerCheck.sqf

if (getPlayerUID _x == _uid) exitWith ..

"Generic error in expression".

and i have no idea why. Anyone that can hlelp me to see what's wrong?

Share this post


Link to post
Share on other sites

Im not sure if I have corrected it fully as I am not at home, and that I may have not sorted out the code properly, but this code...

 hint ("Arma2Net.Unmanaged" callExtension format ["SQLstats [pGUID, '%1']", _clientID]); 

It seems logical if it was written like this

 hint ["Arma2Net.Unmanaged" callExtension format ["SQLstats [pGUID, '%1']", _clientID]]; 

Sorry I cant really check, lots at work today, im only on my 5min break :(

Share this post


Link to post
Share on other sites
Im not sure if I have corrected it fully as I am not at home, and that I may have not sorted out the code properly, but this code...

 hint ("Arma2Net.Unmanaged" callExtension format ["SQLstats [pGUID, '%1']", _clientID]); 

It seems logical if it was written like this

 hint ["Arma2Net.Unmanaged" callExtension format ["SQLstats [pGUID, '%1']", _clientID]]; 

Sorry I cant really check, lots at work today, im only on my 5min break :(

But, has that something to do with the error that i get on line 10?

Anyway, i'll try that out. thank you.

EDIT: Still getting the same error.

Edited by Llano

Share this post


Link to post
Share on other sites

Your passing the _id out of onPlayerConnected rather than the _uid

The hint line seems more logical the way you have it as your hinting the return from a code block ( a call to an extension).

Edited by Larrow

Share this post


Link to post
Share on other sites
Your passing the _id out of onPlayerConnected rather than the _uid

The hint line seems more logical the way you have it as your hinting the return from a code block ( a call to an extension).

Sorry, didn't really understand that. I am passing wrong value?

Share this post


Link to post
Share on other sites

onPlayerConnected "[_id, _name] execVM ""PlayerCheck.sqf""";

Should that not be

onPlayerConnected "[_uid, _name] execVM ""PlayerCheck.sqf""";

From WIKI

as of ArmA 2 version 1.02 this function returns also variable _uid with uniqueID of player.

Otherwise your comparing _id which is a float to getPlayerUID which is a string. Hence the generic error

Edited by Larrow

Share this post


Link to post
Share on other sites
onPlayerConnected "[_id, _name] execVM ""PlayerCheck.sqf""";

Should that not be

onPlayerConnected "[_uid, _name] execVM ""PlayerCheck.sqf""";

From WIKI

Otherwise your comparing _id which is a float to getPlayerUID which is a string. Hence the generic error

Thank you so much! Works perfectly now :)

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×