Show checkpoint only for other Players
#1

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;

Reply
#2

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

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); }
            }    
        }
    }

Reply
#4

Any ideas?
Reply
#5

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


Forum Jump:


Users browsing this thread: 1 Guest(s)