SA-MP Forums Archive
check if is player connected - 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)
+--- Thread: check if is player connected (/showthread.php?tid=618177)



check if is player connected - Bondz - 02.10.2016

PHP код:
public BusinessTimer()
{
    foreach(new 
Business)
    {
        if((
gettime() - BusinessData[i][LastVisited]) > BUSINESS_DAYS 86400)
        {
            
Business_Reset(i);
            continue;
        }
        if(!
BusinessData[i][Closed] && BusinessData[i][SalePrice] == && strcmp(BusinessData[i][Owner], "-"))
        {
            
BusinessData[i][Money] += BusinessData[i][Earning];
            
BusinessData[i][Save] = true;
        }
        if(
BusinessData[i][Save]) Business_Save(i);
    }
    return 
1;

so i want to check if the owner of the business is connected on the server,if they not connected it should return to 0;


Re: check if is player connected - SickAttack - 02.10.2016

Use the IsPlayerConnected function.


Re: check if is player connected - Quinncell - 02.10.2016

Not sure if this is what you meant, like @SickAttack said above, but if it is.
Read this > https://sampwiki.blast.hk/wiki/IsPlayerConnected


Re: check if is player connected - Bondz - 02.10.2016

ok thanks,but why is this code doesnt work?

PHP код:
            new str2[228];
            new 
Float:armour;
            new 
Float:health;
            
GetPlayerArmour(playeridarmour);
            
GetPlayerHealth(playeridhealth);
            
format(str2,sizeof(str2),"~n~~n~~n~~n~~n~~n~~b~~h~~h~%s~n~~w~ARMOUR:%0.2f ~r~Health:%0.2f "pName[damagedid], armourhealth);
            
GameTextForPlayer(playeridstr210003); 
it only shows the playername