SA-MP Forums Archive
Show checkpoint only for other Players - 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: Show checkpoint only for other Players (/showthread.php?tid=633874)



Show checkpoint only for other Players - NBass - 08.05.2017

Hello,
i'm trying to make a Backup Call function, where Police officer, can call a Backup, and for other Players will be tje Checkpoint showed. So far, i have done, but the Checkpoint, shows for me. Any ideas?

PHP код:
new OnDutyPD[MAX_PLAYERS] = 1
PHP код:
else if(playertextid == Pdb[playerid][11]) // PDB Backup
        
{           
            new 
msg[128];
            new 
jobz[128];
            new 
name[MAX_PLAYER_NAME];
            new 
Float:xbackFloat:ybackFloat:zback;
            new 
id GetPlayeridMid(name);
            
GetPlayerPos(playeridxbackybackzback);
            if(
playerDB[playerid][job] == 1jobz"PD";
            
GetPlayerName(playerid,vardas,MAX_PLAYER_NAME);
               
format(msg,sizeof(msg),"{FA8072}[INFO]{FFA500} %s (%s) calling a Backup!",name,jobz);
            
SendMessageToCopsBackup(playeridid,Float:xbackFloat:ybackFloat:zback,COLOR,msg);
            
SendClientMessage(playeridGREEN"Police Backup is Called. Please wait.");
            
IsBackupCalled[playerid] = 1;
               return 
1;

PHP код:
stock SendMessageToCopsBackup(playeridid,Float:xbackFloat:ybackFloat:zback,color,text[])
{
    for(new 
i=0i<MAX_PLAYERSi++)
    {
        if(
IsPlayerConnected(i))
        {
            if(
playerDB[i][job]==1)
            {
                
SendClientMessage(i,color,text);
                if(
id == playerid)
                {
                    return 
1;
                } else {
                    
SetPlayerCheckpoint(ixbackybackzback20.0);
                    return 
1;
                }
            }    
        }
    }
    return 
1;




Re: Show checkpoint only for other Players - Vince - 08.05.2017

Do not return inside loops unless you want to break them.


Re: Show checkpoint only for other Players - NBass - 08.05.2017

Thank you, I'll remember it.

PHP код:
stock SendMessageToCopsBackup(playeridid,Float:xbackFloat:ybackFloat:zback,color,text[])
{
    for(new 
i=0i<MAX_PLAYERSi++)
    {
        if(
IsPlayerConnected(i))
        {
            if(
playerDB[i][specialybe]==1)
            {
                
SendClientMessage(i,color,text);
                if(
id != playerid){ SetPlayerCheckpoint(ixbackybackzback20.0); }
            }    
        }
    }




Re: Show checkpoint only for other Players - NBass - 09.05.2017

Any ideas?


Re: Show checkpoint only for other Players - lollypap54 - 09.05.2017

what is variable id for ? you check with i variable and only at the end put id...