SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 11/09/2018, 03:24 PM   #1
TaligaroW
Little Clucker
 
Join Date: Jun 2018
Posts: 24
Reputation: 0
Default Errors but i don't know how to fix them

Hello everyone,
Today i downloaded zombie apocalypse gamemode and i also downloaded the needed includes,plugins etc.
But when i tried to compile,i god this errors
PHP Code:
C:\Users\mitko\Desktop\Zombie\gamemodes\zm.pwn(309) : error 021symbol already defined"Mode"
C:\Users\mitko\Desktop\Zombie\gamemodes\zm.pwn(548) : error 028invalid subscript (not an array or too many subscripts): "Mode"
C:\Users\mitko\Desktop\Zombie\gamemodes\zm.pwn(548) : warning 215expression has no effect
C
:\Users\mitko\Desktop\Zombie\gamemodes\zm.pwn(548) : error 001expected token";"but found "]"
C:\Users\mitko\Desktop\Zombie\gamemodes\zm.pwn(548) : error 029invalid expressionassumed zero
C
:\Users\mitko\Desktop\Zombie\gamemodes\zm.pwn(548) : fatal error 107too many error messages on one line 
Also i attached my gamemode,if anyone need it to help me..
Attached Files
File Type: pwn zm.pwn (423.3 KB, 3 views)
TaligaroW is offline   Reply With Quote
Old 11/09/2018, 03:36 PM   #2
akib
Huge Clucker
 
akib's Avatar
 
Join Date: Jun 2016
Location: Bangladesh
Posts: 283
Reputation: 2
Default Re: Errors but i don't know how to fix them

I didn't get you what you are doing in this line:
PHP Code:
function StartMap()
{
    foreach(
Player,i//I can't find any function, stock or public forward that called Player?
    
{
        if(
Mode[i] == 1
        {
            
DisablePlayerCheckpoint(i);
            
GameMinutes =4;
            
GameSeconds =59;
            
TogglePlayerSpectating(i,0);
            
air[i] = 1;
            
eopen 1;
            
evaced[i] = 0;
            
roundkills[i] = 0;
            
roundxp[i] = 0;
            
pInfo[i][pRCcars] = 2;
            
ClearAnimations(i);
            
HumanSetup(i);
            
SpawnPlayer(i);
            
CurePlayer(i);
            
SetPlayerDrunkLevel(i,0);
            
pInfo[i][Boxes] = 0;
            
pInfo[i][BoxesAdvanced] = 0;
            
pInfo[i][pVipBoxes] = 3;
            
pInfo[i][pLadders] = 0;
            
pInfo[i][C4] = 2;
            
pInfo[i][pDoctorShield] = 1;
            
pInfo[i][pMapsPlayed]++;
            
DestroyPickup(meatDrops[i]);
            
DestroyObject(DocShield);
            
TextDrawHideForPlayer(iTextdraw0);
            
TextDrawHideForPlayer(iTextdraw1);
            
TextDrawHideForPlayer(iTextdraw2);
            
TextDrawHideForPlayer(iTextdraw3);
            
TextDrawHideForPlayer(iTextdraw4);
            
TextDrawHideForPlayer(iTextdraw5);
            
TextDrawHideForPlayer(iTextdraw6);
            
TextDrawHideForPlayer(iTextdraw7);
            
TextDrawHideForPlayer(iTextdraw8);
            
TextDrawHideForPlayer(iTextdraw9);
            
TextDrawHideForPlayer(iTextdraw10);
            
TextDrawHideForPlayer(iTextdraw12);
            
TextDrawHideForPlayer(iTextdraw13);
            
TextDrawHideForPlayer(iTextdraw14);
            
TextDrawHideForPlayer(iTextdraw15);
            
TextDrawHideForPlayer(iTextdraw16);
            
TextDrawHideForPlayer(iTextdraw17);
            
TextDrawHideForPlayer(iTextdraw18);
            
TextDrawHideForPlayer(iTextdraw19);
            
TextDrawHideForPlayer(iTextdraw20);
            
TextDrawHideForPlayer(iTextdraw21);
            
TextDrawHideForPlayer(iTextdraw22);
            
TextDrawHideForPlayer(iTextdraw23);
            
TextDrawHideForPlayer(iTextdraw24);
            
TextDrawHideForPlayer(iTextdraw25);
            
TextDrawHideForPlayer(iTextdraw26);
            
TextDrawHideForPlayer(iTextdraw27);
            
hellspawn 0;
            
SetCameraBehindPlayer(i);
            
TogglePlayerControllable(i,1);
            new 
IP[22]; // Creating a new string called IP with the maximum length of 22.
            
GetPlayerIp(iIPsizeof(IP));
            new 
INI:File INI_Open(UserPath(i));
            
INI_SetTag(File,"data");
            
INI_WriteString(File"Ip"IP); // We're writing in the .ini file of the player a new line which will contain our string "IP", so it'll look like "Ip = IP String here". If my IP was for example "127.0.0.1" then it'll be "Ip = 127.0.0.1".
            
INI_Close(File);
            
spec[i] = 0;
        }
    }

    
time1 MAX_MAPTIME;

    
SetWeather(Map[Weather]);
    
SetWorldTime(Map[Time]);
    
UpdateMapName();
    
SetTimer("SetAllHuman",1000,false);
    
gateobj CreateObject(Map[GateID],Map[GateX],Map[GateY],Map[GateZ],Map[GaterX],Map[GaterY],Map[GaterZ],500.0);
    
mapvar SetTimer("OnMapUpdate",MAX_MAPUPDATE_TIME,true);
    
balvar SetTimer("OnMapBalance",MAX_BALANCERUPDATE_TIME,true);
    return 
1;

You can replace this with it:
PHP Code:
function StartMap()
{
    foreach(
MAX_PLAYERS,i)
    {
        if(
Mode[i] == 1)
        {
            
DisablePlayerCheckpoint(i);
            
GameMinutes =4;
            
GameSeconds =59;
            
TogglePlayerSpectating(i,0);
            
air[i] = 1;
            
eopen 1;
            
evaced[i] = 0;
            
roundkills[i] = 0;
            
roundxp[i] = 0;
            
pInfo[i][pRCcars] = 2;
            
ClearAnimations(i);
            
HumanSetup(i);
            
SpawnPlayer(i);
            
CurePlayer(i);
            
SetPlayerDrunkLevel(i,0);
            
pInfo[i][Boxes] = 0;
            
pInfo[i][BoxesAdvanced] = 0;
            
pInfo[i][pVipBoxes] = 3;
            
pInfo[i][pLadders] = 0;
            
pInfo[i][C4] = 2;
            
pInfo[i][pDoctorShield] = 1;
            
pInfo[i][pMapsPlayed]++;
            
DestroyPickup(meatDrops[i]);
            
DestroyObject(DocShield);
            
TextDrawHideForPlayer(iTextdraw0);
            
TextDrawHideForPlayer(iTextdraw1);
            
TextDrawHideForPlayer(iTextdraw2);
            
TextDrawHideForPlayer(iTextdraw3);
            
TextDrawHideForPlayer(iTextdraw4);
            
TextDrawHideForPlayer(iTextdraw5);
            
TextDrawHideForPlayer(iTextdraw6);
            
TextDrawHideForPlayer(iTextdraw7);
            
TextDrawHideForPlayer(iTextdraw8);
            
TextDrawHideForPlayer(iTextdraw9);
            
TextDrawHideForPlayer(iTextdraw10);
            
TextDrawHideForPlayer(iTextdraw12);
            
TextDrawHideForPlayer(iTextdraw13);
            
TextDrawHideForPlayer(iTextdraw14);
            
TextDrawHideForPlayer(iTextdraw15);
            
TextDrawHideForPlayer(iTextdraw16);
            
TextDrawHideForPlayer(iTextdraw17);
            
TextDrawHideForPlayer(iTextdraw18);
            
TextDrawHideForPlayer(iTextdraw19);
            
TextDrawHideForPlayer(iTextdraw20);
            
TextDrawHideForPlayer(iTextdraw21);
            
TextDrawHideForPlayer(iTextdraw22);
            
TextDrawHideForPlayer(iTextdraw23);
            
TextDrawHideForPlayer(iTextdraw24);
            
TextDrawHideForPlayer(iTextdraw25);
            
TextDrawHideForPlayer(iTextdraw26);
            
TextDrawHideForPlayer(iTextdraw27);
            
hellspawn 0;
            
SetCameraBehindPlayer(i);
            
TogglePlayerControllable(i,1);
            new 
IP[22]; // Creating a new string called IP with the maximum length of 22.
            
GetPlayerIp(iIPsizeof(IP));
            new 
INI:File INI_Open(UserPath(i));
            
INI_SetTag(File,"data");
            
INI_WriteString(File"Ip"IP); // We're writing in the .ini file of the player a new line which will contain our string "IP", so it'll look like "Ip = IP String here". If my IP was for example "127.0.0.1" then it'll be "Ip = 127.0.0.1".
            
INI_Close(File);
            
spec[i] = 0;
        }
    }

    
time1 MAX_MAPTIME;

    
SetWeather(Map[Weather]);
    
SetWorldTime(Map[Time]);
    
UpdateMapName();
    
SetTimer("SetAllHuman",1000,false);
    
gateobj CreateObject(Map[GateID],Map[GateX],Map[GateY],Map[GateZ],Map[GaterX],Map[GaterY],Map[GaterZ],500.0);
    
mapvar SetTimer("OnMapUpdate",MAX_MAPUPDATE_TIME,true);
    
balvar SetTimer("OnMapBalance",MAX_BALANCERUPDATE_TIME,true);
    return 
1;

__________________
ImKhan#4244
akib is offline   Reply With Quote
Old 11/09/2018, 03:47 PM   #3
solstice_
Gangsta
 
solstice_'s Avatar
 
Join Date: Feb 2016
Location: basement
Posts: 540
Reputation: 68
Default Re: Errors but i don't know how to fix them

Quote:
Originally Posted by akib View Post
I didn't get you what you are doing in this line:
PHP Code:
foreach(Player,i//I can't find any function, stock or public forward that called Player? 
You can replace this with it:
PHP Code:
foreach(MAX_PLAYERS,i
Actually it is fine as it is, you can define that as foreach(new i : Player) too, but I don't think the problem is there.

Anyways, can you post only the line that gives you error and not the whole script? Because I'm too lazy to download it and look at the code, get includes and stuff.
solstice_ is offline   Reply With Quote
Old 11/09/2018, 03:50 PM   #4
akib
Huge Clucker
 
akib's Avatar
 
Join Date: Jun 2016
Location: Bangladesh
Posts: 283
Reputation: 2
Default Re: Errors but i don't know how to fix them

Quote:
Originally Posted by willbedie View Post
Actually it is fine as it is, you can define that as foreach(new i : Player) too, but I don't think the problem is there.

Anyways, can you post only the line that gives you error and not the whole script? Because I'm too lazy to download it and look at the code, get includes and stuff.
Sure thing,
PHP Code:
function StartMap()
{
    foreach(
MAX_PLAYERS,i)
    {
        if(
Mode[i] == 1// Getting error on this line
        
{
            
DisablePlayerCheckpoint(i);
            
GameMinutes =4;
            
GameSeconds =59;
            
TogglePlayerSpectating(i,0);
            
air[i] = 1;
            
eopen 1;
            
evaced[i] = 0;
            
roundkills[i] = 0;
            
roundxp[i] = 0;
            
pInfo[i][pRCcars] = 2;
            
ClearAnimations(i);
            
HumanSetup(i);
            
SpawnPlayer(i);
            
CurePlayer(i);
            
SetPlayerDrunkLevel(i,0);
            
pInfo[i][Boxes] = 0;
            
pInfo[i][BoxesAdvanced] = 0;
            
pInfo[i][pVipBoxes] = 3;
            
pInfo[i][pLadders] = 0;
            
pInfo[i][C4] = 2;
            
pInfo[i][pDoctorShield] = 1;
            
pInfo[i][pMapsPlayed]++;
            
DestroyPickup(meatDrops[i]);
            
DestroyObject(DocShield);
            
TextDrawHideForPlayer(iTextdraw0);
            
TextDrawHideForPlayer(iTextdraw1);
            
TextDrawHideForPlayer(iTextdraw2);
            
TextDrawHideForPlayer(iTextdraw3);
            
TextDrawHideForPlayer(iTextdraw4);
            
TextDrawHideForPlayer(iTextdraw5);
            
TextDrawHideForPlayer(iTextdraw6);
            
TextDrawHideForPlayer(iTextdraw7);
            
TextDrawHideForPlayer(iTextdraw8);
            
TextDrawHideForPlayer(iTextdraw9);
            
TextDrawHideForPlayer(iTextdraw10);
            
TextDrawHideForPlayer(iTextdraw12);
            
TextDrawHideForPlayer(iTextdraw13);
            
TextDrawHideForPlayer(iTextdraw14);
            
TextDrawHideForPlayer(iTextdraw15);
            
TextDrawHideForPlayer(iTextdraw16);
            
TextDrawHideForPlayer(iTextdraw17);
            
TextDrawHideForPlayer(iTextdraw18);
            
TextDrawHideForPlayer(iTextdraw19);
            
TextDrawHideForPlayer(iTextdraw20);
            
TextDrawHideForPlayer(iTextdraw21);
            
TextDrawHideForPlayer(iTextdraw22);
            
TextDrawHideForPlayer(iTextdraw23);
            
TextDrawHideForPlayer(iTextdraw24);
            
TextDrawHideForPlayer(iTextdraw25);
            
TextDrawHideForPlayer(iTextdraw26);
            
TextDrawHideForPlayer(iTextdraw27);
            
hellspawn 0;
            
SetCameraBehindPlayer(i);
            
TogglePlayerControllable(i,1);
            new 
IP[22]; // Creating a new string called IP with the maximum length of 22.
            
GetPlayerIp(iIPsizeof(IP));
            new 
INI:File INI_Open(UserPath(i));
            
INI_SetTag(File,"data");
            
INI_WriteString(File"Ip"IP); // We're writing in the .ini file of the player a new line which will contain our string "IP", so it'll look like "Ip = IP String here". If my IP was for example "127.0.0.1" then it'll be "Ip = 127.0.0.1".
            
INI_Close(File);
            
spec[i] = 0;
        }
    }

    
time1 MAX_MAPTIME;

    
SetWeather(Map[Weather]);
    
SetWorldTime(Map[Time]);
    
UpdateMapName();
    
SetTimer("SetAllHuman",1000,false);
    
gateobj CreateObject(Map[GateID],Map[GateX],Map[GateY],Map[GateZ],Map[GaterX],Map[GaterY],Map[GaterZ],500.0);
    
mapvar SetTimer("OnMapUpdate",MAX_MAPUPDATE_TIME,true);
    
balvar SetTimer("OnMapBalance",MAX_BALANCERUPDATE_TIME,true);
    return 
1;

309 error
PHP Code:
new Mode[MAX_PLAYERS]; 
I checked for that, it's not defined double.
__________________
ImKhan#4244
akib is offline   Reply With Quote
Old 11/09/2018, 03:52 PM   #5
solstice_
Gangsta
 
solstice_'s Avatar
 
Join Date: Feb 2016
Location: basement
Posts: 540
Reputation: 68
Default Re: Errors but i don't know how to fix them

can you post only the line that gives you error and not the whole script
solstice_ is offline   Reply With Quote
Old 11/09/2018, 03:53 PM   #6
TaligaroW
Little Clucker
 
Join Date: Jun 2018
Posts: 24
Reputation: 0
Default Re: Errors but i don't know how to fix them

PHP Code:
new Mode[MAX_PLAYERS]; 
TaligaroW is offline   Reply With Quote
Old 11/09/2018, 03:54 PM   #7
akib
Huge Clucker
 
akib's Avatar
 
Join Date: Jun 2016
Location: Bangladesh
Posts: 283
Reputation: 2
Default Re: Errors but i don't know how to fix them

Quote:
Originally Posted by willbedie View Post
can you post only the line that gives you error and not the whole script
Just don't be too much lazy bro :3 i wrote in comment // where he getting errors
__________________
ImKhan#4244
akib is offline   Reply With Quote
Old 11/09/2018, 04:39 PM   #8
Grim_
High-roller
 
Grim_'s Avatar
 
Join Date: Sep 2008
Location: United States
Posts: 2,897
Reputation: 118
Default Re: Errors but i don't know how to fix them

Quote:
C:\Users\mitko\Desktop\Zombie\gamemodes\zm.pwn(309 ) : error 021: symbol already defined: "Mode"
This is the issue. In one of the includes "Mode" is already defined. You need to rename the array and all of it's occurrences within that file.
Grim_ is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Pawn Compiling errors, Errors and Line are inside [ +REP ] EgyptForLife Scripting Help 8 19/07/2014 08:26 PM
[S-HELP] Compiling errors, Errors and Lines inside. EgyptForLife Scripting Help 3 16/07/2014 07:56 PM
Class Errors: loose indentation (2 Errors) DerickClark Scripting Help 18 22/02/2014 08:01 PM
[ERRORS] Errors appear after adding a Gang System. ••• ĤÁĶÁM ••• Help Archive 17 27/10/2010 05:19 PM
Common compiling errors - READ BEFORE POSTING ERRORS Streetplaya Help Archive 0 23/01/2010 11:20 AM


All times are GMT. The time now is 01:20 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.