SA-MP Forums Archive
Help - 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: Help (/showthread.php?tid=578546)



Help - STONEGOLD - 20.06.2015

PHP код:
public BadCheck()
{
    new 
weapstring[128], pname[MAX_PLAYER_NAME]; // Shortened by 128 Cells, 256 Cells are crap kthx.
    
for(new iGetMaxPlayers(); bi++) // Loop around MaxPlayers Server.cfg varible & removed IsPlayerConnected
    
{
      
GetPlayerName(ipnamesizeof(pname));
      
weap GetPlayerWeapon(i);
      for(new 
wsizeof(BadWeapons); w++)
      {
        if(
pInfo[i][pAdmin] < 1)
        {
            
LoginAttempt[i]++;
            if(
LoginAttempt[i] == 1)
            {
                if(
weap == BadWeapons[w])
                   {
                   
format(string,sizeof(string),"%s has got a %s."pnameweap);
                   
SendClientMessageToAll(RED,string);
                   
ResetPlayerWeapons(i);
                }
            } else if(
LoginAttempt[i] == 2)
                
                if(
weap == BadWeapons[w])
                   {
                   
format(string,sizeof(string),"%s has got a %s."pnameweap);
                   
SendClientMessageToAll(RED,string);
                   
ResetPlayerWeapons(i);
                }
            } else if(
LoginAttempt[i] == 3)
                if(
weap == BadWeapons[w])
                   {
                   
format(string,sizeof(string),"%s has got a %s."pnameweap);
                   
SendClientMessageToAll(RED,string);
                   
ResetPlayerWeapons(i);
                }
            }
            
        }
      }
    }
    return 
1;

Whats wrng here

760 : error 054: unmatched closing brace ("}")
(7609) : error 010: invalid function or declaration


Re: Help - X337 - 20.06.2015

You miss some bracket here
Код:
                else if(LoginAttempt[i] == 2) 
                 // Here
                if(weap == BadWeapons[w]) 
                   { 
                   format(string,sizeof(string),"%s has got a %s.", pname, weap); 
                   SendClientMessageToAll(RED,string); 
                   ResetPlayerWeapons(i); 
                }
Код:
                else if(LoginAttempt[i] == 2) 
                { // Add Bracket Here
                if(weap == BadWeapons[w]) 
                   { 
                   format(string,sizeof(string),"%s has got a %s.", pname, weap); 
                   SendClientMessageToAll(RED,string); 
                   ResetPlayerWeapons(i); 
                }



Re: Help - STONEGOLD - 20.06.2015

Well, Thanks but why isn't working ingame? any idea

PHP код:
public BadCheck()
{
    new 
weapstring[128], pname[MAX_PLAYER_NAME]; // Shortened by 128 Cells, 256 Cells are crap kthx.
    
for(new iGetMaxPlayers(); bi++) // Loop around MaxPlayers Server.cfg varible & removed IsPlayerConnected
    
{
      
GetPlayerName(ipnamesizeof(pname));

      
weap GetPlayerWeapon(i);
      for(new 
wsizeof(BadWeapons); w++)
      {
        if(
pInfo[i][pAdmin] < 1)
        {
            
LoginAttempt[i]++;
            if(
LoginAttempt[i] == 1)
            {
                if(
weap == BadWeapons[w])
                {
                   
format(string,sizeof(string),"%s has got a %s."pnameweap);
                   
SendClientMessageToAll(RED,string);
                   
ResetPlayerWeapons(i);
                }
                return 
1;
            }
            else
            if(
LoginAttempt[i] == 2)
            {
                if(
weap == BadWeapons[w])
                {
                   
format(string,sizeof(string),"%s has got a %s."pnameweap);
                   
SendClientMessageToAll(RED,string);
                   
ResetPlayerWeapons(i);
                }
                return 
1;
            }
            else
            if(
LoginAttempt[i] == 3)
            {
                   if(
weap == BadWeapons[w])
                   {
                      
format(string,sizeof(string),"%s has got a %s."pnameweap);
                      
SendClientMessageToAll(RED,string);
                      
ResetPlayerWeapons(i);
                      
Kick(i);
                   }
                   return 
1;
            }

        }
      }
    }
    return 
1;




Re: Help - Trucido - 20.06.2015

Quote:
Originally Posted by STONEGOLD
Посмотреть сообщение
Well, Thanks but why isn't working ingame? any idea

PHP код:
public BadCheck()
{
    new 
weapstring[128], pname[MAX_PLAYER_NAME]; // Shortened by 128 Cells, 256 Cells are crap kthx.
    
for(new iGetMaxPlayers(); bi++) // Loop around MaxPlayers Server.cfg varible & removed IsPlayerConnected
    
{
      
GetPlayerName(ipnamesizeof(pname));
      
weap GetPlayerWeapon(i);
      for(new 
wsizeof(BadWeapons); w++)
      {
        if(
pInfo[i][pAdmin] < 1)
        {
            
LoginAttempt[i]++;
            if(
LoginAttempt[i] == 1)
            {
                if(
weap == BadWeapons[w])
                {
                   
format(string,sizeof(string),"%s has got a %s."pnameweap);
                   
SendClientMessageToAll(RED,string);
                   
ResetPlayerWeapons(i);
                }
                return 
1;
            }
            else
            if(
LoginAttempt[i] == 2)
            {
                if(
weap == BadWeapons[w])
                {
                   
format(string,sizeof(string),"%s has got a %s."pnameweap);
                   
SendClientMessageToAll(RED,string);
                   
ResetPlayerWeapons(i);
                }
                return 
1;
            }
            else
            if(
LoginAttempt[i] == 3)
            {
                   if(
weap == BadWeapons[w])
                   {
                      
format(string,sizeof(string),"%s has got a %s."pnameweap);
                      
SendClientMessageToAll(RED,string);
                      
ResetPlayerWeapons(i);
                      
Kick(i);
                   }
                   return 
1;
            }
        }
      }
    }
    return 
1;

Код:
 for(new i; i < MAX_PLAYERS; i++)