Help me to fix this
#1

I have eror like this
Код:
C:\Documents and Settings\user\Desktop\SATDM\gamemodes\SATDM.pwn(30740) : warning 219: local variable "name" shadows a variable at a preceding level
C:\Documents and Settings\user\Desktop\SATDM\gamemodes\SATDM.pwn(30755) : error 035: argument type mismatch (argument 2)
C:\Documents and Settings\user\Desktop\SATDM\gamemodes\SATDM.pwn(30755) : error 035: argument type mismatch (argument 2)
C:\Documents and Settings\user\Desktop\SATDM\gamemodes\SATDM.pwn(30756) : error 035: argument type mismatch (argument 1)
C:\Documents and Settings\user\Desktop\SATDM\gamemodes\SATDM.pwn(30740) : warning 204: symbol is assigned a value that is never used: "name"
C:\Documents and Settings\user\Desktop\SATDM\gamemodes\SATDM.pwn(30819) : warning 219: local variable "name" shadows a variable at a preceding level
C:\Documents and Settings\user\Desktop\SATDM\gamemodes\SATDM.pwn(30821) : error 035: argument type mismatch (argument 2)
C:\Documents and Settings\user\Desktop\SATDM\gamemodes\SATDM.pwn(30821) : error 035: argument type mismatch (argument 2)
C:\Documents and Settings\user\Desktop\SATDM\gamemodes\SATDM.pwn(30823) : error 017: undefined symbol "invited"
C:\Documents and Settings\user\Desktop\SATDM\gamemodes\SATDM.pwn(30823) : warning 215: expression has no effect
C:\Documents and Settings\user\Desktop\SATDM\gamemodes\SATDM.pwn(30823) : error 001: expected token: ";", but found "]"
C:\Documents and Settings\user\Desktop\SATDM\gamemodes\SATDM.pwn(30823) : error 029: invalid expression, assumed zero
C:\Documents and Settings\user\Desktop\SATDM\gamemodes\SATDM.pwn(30823) : fatal error 107: too many error messages on one line
Reply
#2

Show us your code maybe?
Reply
#3

To help you we need of the script
Reply
#4

this
PHP код:
CMD:gang(playerid,params[]) {
    new 
tmp[256], tmp2[256], Indextmp strtok(params,Index), tmp2 strtok(params,Index);
    if(!
strlen(tmp)) return SendClientMessage(playeridPlayerColors[random(200)], "USE: /gang [create/invite/join/leave/stats/list]");
    
//---- Create a Gang
     
if(strcmp(tmp"create"true) == 0)
    {
        if(!
strlen(tmp2)) return SendClientMessage(playeridPlayerColors[random(200)], "USE: /gang create [GangName]");
        if(
strlen(tmp2) < || strlen(tmp2) > 15) {
            return 
SendClientMessage(playeridPlayerColors[random(200)], "Gang name must be between 3 and 15 characters");
        }
        if(
PlayerInfo[playerid][gang] != 0)
        {
            return 
SendClientMessage(playeridPlayerColors[random(200)], "You must leave your gang before make a new one. /gang leave");
        }
        
//Remove Inactive Gangs
        
if(GANG_NUMBER >= MAX_GANG)
        {
            new 
string[128];
            new 
file[30];
            new 
name[MAX_PLAYER_NAME];
            for(new 
0<= GANG_NUMBERi++)
            {
                
format(filesizeof(file), GANG_FILEi);
                if(
dini_Exists(file) && dini_Int(file,"GANG_MEMBERS") <= 1)
                {
                    
dini_Remove(file);
                    
format(stringsizeof(string), "Gang Removed: ID:%d, Members: %d, Name: %s"iGangInfo[i][GANG_MEMBERS], GangInfo[i][GANG_NAME]);
                    
SendClientMessage(playeridPlayerColors[random(200)], string);
                    
format(stringsizeof(string), "The gang %s has been removed"GangInfo[i][GANG_NAME]);
                    
SendClientMessageToAll(PlayerColors[random(200)], string);
                    for(new 
pMAX_PLAYERSp++)
                    {
                        if(
PlayerInfo[p][gang] == && IsPlayerConnected(p))
                        {
                            
GetPlayerName(pnamesizeof(name));
                            
DOF2_SetInt(DOF2_File(name), "Gang"0);
                            
PlayerInfo[p][gang] = 0;
                        }
                    }
                }
            }
        }
        new 
gangid 0;
        for(new 
iGANG_NUMBERi++)
          {
            new 
file[100];
            
format(filesizeof(file), GANG_FILEi);
            if(
dini_Exists(file))
            {
                   new 
gname[15];
                
strcat(gnamedini_Get(file"GANG_NAME"),15);
                if(
strfind(tmp2gnametrue) == 0)
                {
                    return 
SendClientMessage(playeridPlayerColors[random(200)], "There is already a gang with the same name");
                }
            }
            else if(!
dini_Exists(file) && != 0gangid i;
        }
           if(
gangid == 0) {
            
GANG_NUMBER++;
            
gangid GANG_NUMBER;
        }
        
dini_IntSet(CFG,"GANG_NUMBER",GANG_NUMBER);
          new 
gfile[100];
        
format(gfilesizeof(gfile), GANG_FILEgangid);
        
dini_Create(gfile);
          
format(GangInfo[gangid][GANG_NAME], sizeof(tmp2), "%s"tmp2);
        
dini_Set(gfile"GANG_NAME"GangInfo[gangid][GANG_NAME]);
        
dini_IntSet(gfile"GANG_ID"gangid);
        
dini_IntSet(gfile,"GANG_MEMBERS",0);
        
GangInfo[gangid][GANG_ID] = gangid;
        
GangInfo[gangid][GANG_MEMBERS] = 0;
        
GangInfo[gangid][GANG_COLOR] = PlayerColors[gangid];
        new 
string[128];
        
format(stringsizeof(string), "Gang Created. Name: %s, ID: %d"GangInfo[gangid][GANG_NAME], GangInfo[gangid][GANG_ID]);
        
SendClientMessage(playeridPlayerColors[random(200)], string);
        
JoinGang(playeridgangid);
        return 
1;
    }
    
//---- Invite
    
if(strcmp(tmp"invite"true) == 0)
    {
        if(!
strlen(tmp2)) return SendClientMessage(playeridPlayerColors[random(200)], "USE: /gang invite [ID]");
        if(
PlayerInfo[playerid][gang] == 0)
        {
             return 
SendClientMessage(playeridPlayerColors[random(200)], "You are not in a gang");
        }
        if(
GangInfo[PlayerInfo[playerid][gang]][GANG_MEMBERS] > 14)
        {
            return 
SendClientMessage(playeridPlayerColors[random(200)], "Has reached the maximum number of members (15) for this gang");
        }
        new 
id strval(tmp2);
        if(!
IsPlayerConnected(id)) return SendClientMessage(playeridPlayerColors[random(200)], "Invalid ID");
        new 
name[MAX_PLAYER_NAME];
        new 
name1[MAX_PLAYER_NAME];
        
GetPlayerName(idnamesizeof(name));
        
GetPlayerName(playeridname1sizeof(name1));
        
invited[id] = PlayerInfo[playerid][gang];
        new 
string[256];
        
format(stringsizeof(string), "You have been invited by %s to join in the gang %s. /gang join"name1GangInfo[PlayerInfo[playerid][gang]][GANG_NAME]);
        
SendClientMessage(idPlayerColors[random(200)], string);
        
format(stringsizeof(string), "You invited %s to join in your gang"name);
        
SendClientMessage(playeridPlayerColors[random(200)], string);
        return 
1;
    }
    
//---- Join Gang
    
if(strcmp(tmp"join"true) == 0)
    {
        if(
PlayerInfo[playerid][gang] != 0) return SendClientMessage(playeridPlayerColors[random(200)], "You are already in a gang.");
        if(
invited[playerid] == 0) return SendClientMessage(playeridPlayerColors[random(200)], "You have not been invited to join that gang.");
        
JoinGang(playeridinvited[playerid]);
        return 
1;
    }
    
//---- Leave Gang
    
if(strcmp(tmp"leave"true) == 0)
    {
        if(
PlayerInfo[playerid][gang] == 1){
            new 
name[MAX_PLAYER_NAME];
            
GetPlayerName(playeridnamesizeof(name));
            
DOF2_SetInt(DOF2_File(name), "Gang"0);
            
PlayerInfo[playerid][gang] = 0;
            if(
PlayerInfo[playerid][gang] == 0)
            {
                 return 
SendClientMessage(playeridPlayerColors[random(200)], "You are not in a gang");
            }
        }
        
LeaveGang(playeridPlayerInfo[playerid][gang]);
        return 
1;
    }
    
//---- List
    
if(strcmp(tmp"list"true) == 0)
    {
        new 
string[256];
        new 
file[100];
        new 
string2[256];
        
format(stringsizeof(string), "");
        for(new 
0<= GANG_NUMBERi++)
        {
              
format(filesizeof(file), GANG_FILEi);
            if(
dini_Exists(file)) {
                    
format(string2sizeof(string2), "%s,"GangInfo[i][GANG_NAME]);
                    
format(stringsizeof(string), "%s %s"stringstring2);
            }
        }
        
SendClientMessage(playeridPlayerColors[random(200)], string);
        return 
1;
    }
    
//---- Stats
    
if(strcmp(tmp"stats"true) == 0)
    {
        if(
PlayerInfo[playerid][gang] == 0)
        {
             return 
SendClientMessage(playeridPlayerColors[random(200)], "You are not in a gang");
        }
        new 
gangid PlayerInfo[playerid][gang];
        new 
string[128];
        
GangInfo[gangid][GANG_NZONE] = 0;
        for(new 
0<= ZONE_NUMBERi++)
        {
            new 
SplitDiv[99][MAX_ZONE];
            new 
tmp3[256];
            new 
zoneids[5];
            
valstr(zoneids,i);
            
tmp3 dini_Get(ZONE_FILE,zoneids);
            
split(tmp3SplitDiv',');
            if(
dini_Exists(ZONE_FILE) && GangInfo[gangid][GANG_ID] == strval(SplitDiv[0])) GangInfo[gangid][GANG_NZONE]++;
        }
        
format(stringsizeof(string), "ID: %d"gangid);
        
SendClientMessage(playeridPlayerColors[random(200)], string);
        
format(stringsizeof(string), "Gang Name: %s"GangInfo[gangid][GANG_NAME]);
        
SendClientMessage(playeridPlayerColors[random(200)], string);
        
format(stringsizeof(string), "Members: %d"GangInfo[gangid][GANG_MEMBERS]);
        
SendClientMessage(playeridPlayerColors[random(200)], string);
          
format(stringsizeof(string), "Number of Gang Zones: %d"GangInfo[gangid][GANG_NZONE]);
        
SendClientMessage(playeridPlayerColors[random(200)], string);
        return 
1;
    }
    
//---- Delete Inactive
    
if(strcmp(tmp"di"true) == 0)
    {
        if(!
IsPlayerAdmin(playerid)) return SendClientMessage(playeridPlayerColors[random(200)], "You must be rcon admin to do this!");
        new 
file[30];
        new 
name[MAX_PLAYER_NAME];
        for(new 
gm 0gm <= GANG_NUMBERgm++)
        {
            
format(filesizeof(file), GANG_FILEgm);
            if(
dini_Exists(file) && dini_Int(file,"GANG_MEMBERS") <= 1)
            {
                
dini_Remove(file);
                
format(stringsizeof(string), "Gang Removed: ID:%d, Members: %d, Name: %s"gmGangInfo[gm][GANG_MEMBERS], GangInfo[gm][GANG_NAME]);
                
SendClientMessage(playeridPlayerColors[random(200)], string);
                for(new 
pMAX_PLAYERSp++)
                {
                    if(
PlayerInfo[p][gang] == gm && IsPlayerConnected(p))
                    {
                        
GetPlayerName(pnamesizeof(name));
                        
DOF2_SetInt(DOF2_File(name), "Gang"0);
                        
PlayerInfo[p][gang] = 0;
                    }
                }
            }
        }
        return 
1;
    }
    
//---- Help
    
if(strcmp(tmp"ganghelp"true) == 0)
    {
        
SendClientMessage(playeridPlayerColors[random(200)], "Use: /Gang create to create gang");
        
SendClientMessage(playeridPlayerColors[random(200)], "Use: /Gang invite for invite a player in your gang");
        
SendClientMessage(playeridPlayerColors[random(200)], "Use: /Gang join for join a gang if you are invited");
        
SendClientMessage(playeridPlayerColors[random(200)], "Use: /Gang leave for leave a gang");
        
SendClientMessage(playeridPlayerColors[random(200)], "Use: /Gang stats for gang statistics");
        
SendClientMessage(playeridPlayerColors[random(200)], "Use: /Gang list for a list of all gangs");
        
SendClientMessage(playeridPlayerColors[random(200)],"! (prefix text for gang-chat)");
        
SendClientMessage(playeridPlayerColors[random(200)], "To attack a gang zone 3 members of your gang must stay there for 2 minutes");
        
SendClientMessage(playeridPlayerColors[random(200)], "When the 3 members invade the gangzone, it will flash until it is taken");
        return 
1;
    }
    else 
SendClientMessage(playeridPlayerColors[random(200)], "USE: /gang [create/invite/join/leave/stats/list]");
    return 
1;
}
//---- Join Gang
public JoinGang(playeridgangid)
{
    new 
name[MAX_PLAYER_NAME];
    new 
gfile[100];
    
format(gfilesizeof(gfile), GANG_FILEgangid);
    
GetPlayerName(playeridnamesizeof(name));
    
DOF2_SetInt(DOF2_File(name), "Gang"gangid);
    new 
string[128];
    
PlayerInfo[playerid][gang] = gangid;
    
GangInfo[gangid][GANG_MEMBERS]++;
    
format(stringsizeof(string), "You joined the gang %s, Members: %d"GangInfo[gangid][GANG_NAME], GangInfo[gangid][GANG_MEMBERS]);
    
SendClientMessage(playeridPlayerColors[random(200)], string);
    
format(stringsizeof(string), "%s Has joined the gang %s"name GangInfo[gangid][GANG_NAME]);
    
SendClientMessageToAll(PlayerColors[random(200)], string);
    
SetPlayerColor(playeridGangInfo[gangid][GANG_COLOR]);
    
dini_IntSet(gfile"GANG_MEMBERS"GangInfo[gangid][GANG_MEMBERS]);
    return 
1;
}
//---- Leave Gang
public LeaveGang(playeridgangid)
{
    new 
name[MAX_PLAYER_NAME];
    new 
gfile[100];
    
format(gfilesizeof(gfile), GANG_FILEgangid);
    
GetPlayerName(playeridnamesizeof(name));
    
DOF2_SetInt(DOF2_File(name), "Gang"0);
    new 
string[128];
    
format(stringsizeof(string), "You left the gang %s"GangInfo[gangid][GANG_NAME]);
    
SendClientMessage(playeridPlayerColors[random(200)], string);
    
format(stringsizeof(string), "%s has left gang %s"name GangInfo[gangid][GANG_NAME]);
    
SendClientMessageToAll(PlayerColors[random(200)], string);
    
PlayerInfo[playerid][gang] = 0;
    
GangInfo[gangid][GANG_MEMBERS]--;
    
SetPlayerColor(playeridPlayerColors[random(200)]);
    if(
GangInfo[gangid][GANG_MEMBERS] == 0) {
        
format(stringsizeof(string), "The gang %s was abandoned"GangInfo[gangid][GANG_NAME]);
        
SendClientMessageToAll(PlayerColors[random(200)], string);
        return 
dini_Remove(gfile);
    }
    
dini_IntSet(gfile"GANG_MEMBERS"GangInfo[gangid][GANG_MEMBERS]);
    return 
1;

Reply
#5

Give the lines too.
Reply
#6

Change the "name" to some other name (the parts that name is used as well) because it's already declared as global. That will solve most of your errors/warnings.

invited is undefined symbol so you need to declare it:
pawn Код:
new invited[MAX_PLAYERS];
Reply
#7

Line 30741
PHP код:
            new name[MAX_PLAYER_NAME];
            for(new 
0<= GANG_NUMBERi++)
            {
                
format(filesizeof(file), GANG_FILEi);
                if(
dini_Exists(file) && dini_Int(file,"GANG_MEMBERS") <= 1)
                {
                    
dini_Remove(file);
                    
format(stringsizeof(string), "Gang Removed: ID:%d, Members: %d, Name: %s"iGangInfo[i][GANG_MEMBERS], GangInfo[i][GANG_NAME]);
                    
SendClientMessage(playeridPlayerColors[random(200)], string);
                    
format(stringsizeof(string), "The gang %s has been removed"GangInfo[i][GANG_NAME]);
                    
SendClientMessageToAll(PlayerColors[random(200)], string);
                    for(new 
pMAX_PLAYERSp++)
                    {
                        if(
PlayerInfo[p][gang] == && IsPlayerConnected(p))
                        { 
Line 30756 & 30757
PHP код:
                            GetPlayerName(pnamesizeof(name));
                            
DOF2_SetInt(DOF2_File(name), "Gang"0); 
Line 30820 & 30824
PHP код:
        new name[MAX_PLAYER_NAME];
        new 
name1[MAX_PLAYER_NAME];
        
GetPlayerName(idnamesizeof(name));
        
GetPlayerName(playeridname1sizeof(name1));
        
invited[id] = PlayerInfo[playerid][gang]; 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)