Quantcast
Channel: SA-MP Forums
Viewing all articles
Browse latest Browse all 18226

Question

$
0
0
I help a friend with a prison rp gamemode and i found this:
PHP Code:

COMMAND:pm(playeridparams[])
{
    new 
targetidmessage[128], str[128], i;
    
0;
    if(
sscanf(params,"us[128]"targetidmessage))return SendClientMessage(playeridGREY"USAGE: /pm [playerid] [message]");
    if(!
IsPlayerConnected(targetid)) return SendClientMessage(playeridGREY"ID-ul tinta nu exista.");
    if(
targetid == playerid) return SendClientMessage(playeridGREY"Nu iti poti trimite PM singur.");
    if(
PlayerStat[playerid][TogPM] == 1) return SendClientMessage(playeridGREY"You have disabled PMs (/togpm to enable them).");
    if(
PlayerStat[playerid][AdminLevel] < && PlayerStat[targetid][TogPM] == 1) return SendClientMessage(playeridGREY"The player has disabled PMs.");
    if(
PlayerStat[playerid][AdminLevel] < && AutoPM[targetid][0] != 0)
    {
        
format(strsizeof(str), "(([%d]AutoPM from %s: %s))"targetidGetOOCName(targetid), AutoPM[targetid]);
        
SendClientMessage(playeridYELLOWstr);
        return 
1;
    }
    if(
Server[PMsStatus] == 0) return SendClientMessage(playeridGREY"PMs are disabled by an admin.");
    if(
strlen(message) < 1) return SendClientMessage(playeridGREY"Mesajul este prea scurt.");
    if(
strlen(message) > 100) return SendClientMessage(playeridGREY"Mesajul este prea lung.");
    
format(strsizeof(str), "(([%d]PM from %s: %s))"playeridGetOOCName(playerid), message);
    
SendClientMessage(targetidYELLOWstr);
    if(
PMsTracked[targetid] == 1)
    {
        
loop_start1:
        if(
IsPlayerConnected(i) == 1)
        {
            if(
MAX_PLAYERS)
            {
                goto 
script_continue;
            }
            if(
TrackPMs[i] == targetid)
            {
                
format(strsizeof(str), "((PM from %s to %s: %s))"GetOOCName(playerid), GetOOCName(targetid), message);
                
SendClientMessage(iYELLOWstr);
                
PlayerPlaySound(i10850,0);
                
i++;
                goto 
loop_start1;
            }
            else
            {
                
i++;
                goto 
loop_start1;
            }
        }
        else
        {
            
i++;
            goto 
loop_start1;
        }
    }
    if(
PMsTracked[playerid] == 1)
    {
        
loop_start2:
        if(
IsPlayerConnected(i) == 1)
        {
            if(
MAX_PLAYERS)
            {
                goto 
script_continue;
            }
            if(
TrackPMs[i] == playerid)
            {
                
format(strsizeof(str), "((PM from %s to %s: %s))"GetOOCName(playerid), GetOOCName(targetid), message);
                
SendClientMessage(iYELLOWstr);
                
PlayerPlaySound(i10850,0);
                
i++;
                goto 
loop_start2;
            }
            else
            {
                
i++;
                goto 
loop_start2;
            }
        }
        else
        {
            
i++;
            goto 
loop_start2;
        }
    }
    
script_continue:
    
PlayerPlaySound(targetid10850,0);
    
format(strsizeof(str), "(([%d]PM to %s: %s))"targetidGetOOCName(targetid), message);
    
PlayerPlaySound(playerid11370,0);
    
SendClientMessage(playeridYELLOWstr);
    
format(strsizeof(str), "%s PM'd %s: %s"GetOOCName(playerid), GetOOCName(targetid), message);
    
PMLog(str);
    return 
1;


Anyone here that can explain me this:
PHP Code:

loop_start1:
        if(
IsPlayerConnected(i) == 1)
        {
            if(
MAX_PLAYERS)
            {
                goto 
script_continue;
            }
            if(
TrackPMs[i] == targetid)
            {
                
format(strsizeof(str), "((PM from %s to %s: %s))"GetOOCName(playerid), GetOOCName(targetid), message);
                
SendClientMessage(iYELLOWstr);
                
PlayerPlaySound(i10850,0);
                
i++;
                goto 
loop_start1;
            }
            else
            {
                
i++;
                goto 
loop_start1;
            }
        }
        else
        {
            
i++;
            goto 
loop_start1;
        } 

I know its a loop type of deal but i wonder how its work more precise. And if there is a alternative to this. For me look strange....

Viewing all articles
Browse latest Browse all 18226

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>