[ERRORS] Errors appear after adding a Gang System.
#1

Okay, before I start this simple request from everyone. Please do not waste your time telling me to use the search button, because I wouldn't create this thread if I did not use it, or find a solution, and get it working.

It is either you help, or just get out of the thread and stop wasting your time, because it won't help you.

Back to the thread, I'm having some problems while I am compiling the script, the errors are:

Code:
C:\Users\rodi\Desktop\LV-DM\gamemodes\lvdm.pwn(540) : error 003: declaration of a local variable must appear in a compound block
C:\Users\rodi\Desktop\LV-DM\gamemodes\lvdm.pwn(540) : warning 217: loose indentation
C:\Users\rodi\Desktop\LV-DM\gamemodes\lvdm.pwn(540) : error 017: undefined symbol "tmp"
C:\Users\rodi\Desktop\LV-DM\gamemodes\lvdm.pwn(540) : warning 215: expression has no effect
C:\Users\rodi\Desktop\LV-DM\gamemodes\lvdm.pwn(540) : error 001: expected token: ";", but found "]"
C:\Users\rodi\Desktop\LV-DM\gamemodes\lvdm.pwn(540) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
I'm pretty 65% sure that you guys can help me out to solve this without seeing the actual code. If you're willing to see a actual code, then you can just turn your back off and goto a another thread to steal their codes. You can actually keep reading this if you're really trusted in SA-MP, just hit me up a private message.
Reply
#2

Please post line 540
Reply
#3

pawn Code:
if (strcmp("/gang", cmdtext, true, 10) == 0)
            new tmp[256]; //Line 540
            new gangcmd, gangnum;
            tmp = strtok(cmdtext, idx);
I'm kind-of sure that the problem isn't from that line, it's from another line but this line is attempting to failure it or crash it?
Reply
#4

if(strcmp(cmdtext, "/gang", true) == 0)
Try that
Reply
#5

Quote:
Originally Posted by [UG]Scripter
View Post
if(strcmp(cmdtext, "/gang", true) == 0)
Try that
No luck, anyone else could help?
Reply
#6

Can you post the Entire Command.

Then copy and paste the affected line below all th code leaving it in the full code.
Reply
#7

pawn Code:
if(strcmp(cmdtext, "/gang", true) == 0) {
// code
}
Reply
#8

Quote:
Originally Posted by Calgon
View Post
pawn Code:
if(strcmp(cmdtext, "/gang", true) == 0) {
// code
}
No luck. Tried that too. About [UG]Scripter, I'll give it a go and give you the actual code.

pawn Code:
if(strcmp(cmdtext, "/gang", true) == 0)
            new tmp[256];
            new gangcmd, gangnum;
            tmp = strtok(cmdtext, idx);
        if(!strlen(tmp)) {
            SendClientMessage(playerid, COLOR_WHITE, "USAGE: /gang [create/join/invite/quit] [name/number]");
            return 1;
        }
        giveplayerid = strval(tmp);

        if(strcmp(tmp, "create", true)==0)
            gangcmd = 1;
        else if(strcmp(tmp, "invite", true)==0)
            gangcmd = 2;
        else if(strcmp(tmp, "join", true)==0)
            gangcmd = 3;
        else if(strcmp(tmp, "quit", true)==0)
            gangcmd = 4;

        tmp = strtok(cmdtext, idx);
        if(gangcmd < 3 && !strlen(tmp)) {
            if(gangcmd==0)
                SendClientMessage(playerid, COLOR_WHITE, "USAGE: /gang [create/join/invite/quit] [name/number]");
            else if(gangcmd==1)
                SendClientMessage(playerid, COLOR_WHITE, "USAGE: /gang [create] [name]");
            else if(gangcmd==2)
                SendClientMessage(playerid, COLOR_WHITE, "USAGE: /gang [invite] [playerID]");
            return 1;
        }

        //Create Gang//
        if(gangcmd==1) {
            if(playerGang[playerid]>0) {
                SendClientMessage(playerid, COLOR_RED, "You are already in a gang!");
                return 1;
            }

            for(new i = 1; i < MAX_GANGS; i++) {
                if(gangInfo[i][0]==0) {
                    //name gang
                    format(gangNames[i], MAX_GANG_NAME, "%s", tmp);
                    //Gang exists
                    gangInfo[i][0]=1;
                    //There is one member
                    gangInfo[i][1]=1;
                    //Gang color is player's color
                    gangInfo[i][2]=playerColors[playerid];

                    //Player is the first gang member
                    gangMembers[i][0] = playerid;
                    format(string, sizeof(string),"You have created the gang '%s' (id: %d)", gangNames[i], i);
                    SendClientMessage(playerid, COLOR_GREEN, string);

                    playerGang[playerid]=i;

                    return 1;
                }
            }

            return 1;

        //Join Gang//
        } else if (gangcmd==3) {
            gangnum = gangInvite[playerid];

            if(playerGang[playerid]>0) {
                SendClientMessage(playerid, COLOR_RED, "You are already in a gang!");
                return 1;
            }
            if(gangInvite[playerid]==0) {
                SendClientMessage(playerid, COLOR_RED, "You have not been invited to a gang.");
                return 1;
            }
            if(gangInfo[gangnum][0]==0) {
                SendClientMessage(playerid, COLOR_RED, "That gang does not exist!");
                return 1;
            }

            if(gangInfo[gangnum][1] < MAX_GANG_MEMBERS) {
                new i = gangInfo[gangnum][1];

                gangInvite[playerid]=0;

                gangMembers[gangnum][i] = playerid;

                GetPlayerName(playerid, sendername, MAX_PLAYER_NAME);
                for(new j = 0; j < gangInfo[gangnum][1]; j++) {
                    format(string, sizeof(string),"%s has joined your gang.", sendername);
                    SendClientMessage(gangMembers[gangnum][j], COLOR_ORANGE, string);
                }

                gangInfo[gangnum][1]++;
                playerGang[playerid] = gangnum;

                SetPlayerColor(playerid,gangInfo[gangnum][2]);

                format(string, sizeof(string),"You have joined the gang '%s' (id: %d)", gangNames[gangnum], gangnum);
                SendClientMessage(playerid, COLOR_GREEN, string);

                return 1;
            }

            SendClientMessage(playerid, COLOR_RED, "That gang is full.");
            return 1;

        //Invite to Gang//
        } else if (gangcmd==2) {
            giveplayerid = strval(tmp);

            if(playerGang[playerid]==0) {
                SendClientMessage(playerid, COLOR_RED, "You are not in a gang!");
                return 1;
            }
//          if(gangMembers[playerGang[playerid]][0]!=playerid) {
//              SendClientMessage(playerid, COLOR_RED, "You need to be the gang leader to send an invite.");
//              return 1;
//          }

            if(IsPlayerConnected(giveplayerid)) {
                GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                GetPlayerName(playerid, sendername, sizeof(sendername));

                format(string, sizeof(string),"You have sent a gang invite to %s.", giveplayer);
                SendClientMessage(playerid, COLOR_GREEN, string);
                format(string, sizeof(string),"You have recieved a gang invite from %s to '%s' (id: %d)", sendername, gangNames[playerGang[playerid]],playerGang[playerid]);
                SendClientMessage(giveplayerid, COLOR_GREEN, string);

                gangInvite[giveplayerid]=playerGang[playerid];

            } else
                SendClientMessage(playerid, COLOR_RED, "No such player exists!");

        //Leave Gang//
        } else if (gangcmd==4) {
            PlayerLeaveGang(playerid);
        }

        return 1;
    }
Really appreciated if someone has at least 2 minutes to solve this out for me. As I said, really appreciated! Good luck to everyone.
Reply
#9

Excuse me, everyone. Looking forward for help, really appreciated.
Reply
#10

••• BUMP •••
Reply
#11

Use DCMD oy YCMD.... strcmp is for noobs.

As you being the owner of DP, i didnt think you would use shitty strcmp :P
Reply
#12

Advice: If you're going to rip commands from other scripts, atleast learn to rip everything needed correctly.
Reply
#13

Quote:
Originally Posted by miokie
Посмотреть сообщение
Advice: If you're going to rip commands from other scripts, atleast learn to rip everything needed correctly.
+1

Unsuccessful leecher is unsuccessful.
Reply
#14

Quote:
Originally Posted by DiddyBop
Посмотреть сообщение
Use DCMD oy YCMD.... strcmp is for noobs.

As you being the owner of DP, i didnt think you would use shitty strcmp :P
Who told you that I own Drift-Planet? Ehm.

@Miokie: I don't think so since this script is made by my friend called Mevlan, so I didn't want to type another one if we already got one ready. No offense.

@DiddyBop: Good for you.
Reply
#15

Quote:
Originally Posted by ••• ĤБĶБM •••
Посмотреть сообщение
Who told you that I own Drift-Planet? Ehm.
from Here... Has all server owner names that where ever made.. duhh


This forum requires that you wait 120 seconds between posts. Please try again in 36 seconds. FTW!
Reply
#16

Quote:
Originally Posted by DiddyBop
Посмотреть сообщение
from Here... Has all server owner names that where ever made.. duhh


This forum requires that you wait 120 seconds between posts. Please try again in 36 seconds. FTW!
Nice try, but I didn't click it! Hover the mouse on it first, and see where will it take you. Sorry, you failed once again.

Anyways, to everyone, looking forward to help me out.
Reply
#17

Only thing i can see wrong is the lack of { in the beginning. But i dont know much about strcmp command uses.
Reply
#18

pawn Код:
if(strcmp(cmdtext, "/gang", true) == 0)
    {
        new tmp[256], idx, gangcmd, gangnum;
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp))
        {
            SendClientMessage(playerid, COLOR_WHITE, "USAGE: /gang [create/join/invite/quit] [name/number]");
            return 1;
        }
        giveplayerid = strval(tmp);

        if(strcmp(tmp, "create", true)==0) gangcmd = 1;
        else if(strcmp(tmp, "invite", true)==0) gangcmd = 2;
        else if(strcmp(tmp, "join", true)==0) gangcmd = 3;
        else if(strcmp(tmp, "quit", true)==0) gangcmd = 4;

        if(gangcmd < 3 && !strlen(tmp))
        {
            if(gangcmd==0) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /gang [create/join/invite/quit] [name/number]");
            else if(gangcmd==1) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /gang [create] [name]");
            else if(gangcmd==2) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /gang [invite] [playerID]");
        }

        //Create Gang//
        if(gangcmd==1) {
            if(playerGang[playerid]>0) return SendClientMessage(playerid, COLOR_RED, "You are already in a gang!");
            for(new i = 1; i < MAX_GANGS; i++)
            {
                if(gangInfo[i][0]==0) {
                    //name gang
                    format(gangNames[i], MAX_GANG_NAME, "%s", tmp);
                    //Gang exists
                    gangInfo[i][0]=1;
                    //There is one member
                    gangInfo[i][1]=1;
                    //Gang color is player's color
                    gangInfo[i][2]=playerColors[playerid];

                    //Player is the first gang member
                    gangMembers[i][0] = playerid;
                    format(string, sizeof(string),"You have created the gang '%s' (id: %d)", gangNames[i], i);
                    SendClientMessage(playerid, COLOR_GREEN, string);

                    playerGang[playerid]=i;

                    return 1;
                }
            }

            return 1;

        //Join Gang//
        }
        else if (gangcmd==3)
        {
            gangnum = gangInvite[playerid];

            if(playerGang[playerid]>0) return SendClientMessage(playerid, COLOR_RED, "You are already in a gang!");
            if(gangInvite[playerid]==0) return SendClientMessage(playerid, COLOR_RED, "You have not been invited to a gang.");
            if(gangInfo[gangnum][0]==0) return SendClientMessage(playerid, COLOR_RED, "That gang does not exist!");
            if(gangInfo[gangnum][1] >= MAX_GANG_MEMBERS) return SendClientMessage(playerid, COLOR_RED, "That gang is full.");
            {
                new i = gangInfo[gangnum][1];

                gangInvite[playerid]=0;

                gangMembers[gangnum][i] = playerid;

                GetPlayerName(playerid, sendername, MAX_PLAYER_NAME);
                for(new j = 0; j < gangInfo[gangnum][1]; j++)
                {
                    format(string, sizeof(string),"%s has joined your gang.", sendername);
                    SendClientMessage(gangMembers[gangnum][j], COLOR_ORANGE, string);
                }

                gangInfo[gangnum][1]++;
                playerGang[playerid] = gangnum;

                SetPlayerColor(playerid,gangInfo[gangnum][2]);

                format(string, sizeof(string),"You have joined the gang '%s' (id: %d)", gangNames[gangnum], gangnum);
                SendClientMessage(playerid, COLOR_GREEN, string);

                return 1;
            }
        //Invite to Gang//
        }
        else if (gangcmd==2)
        {
            giveplayerid = strval(tmp);

            if(playerGang[playerid]==0) return SendClientMessage(playerid, COLOR_RED, "You are not in a gang!");
//          if(gangMembers[playerGang[playerid]][0]!=playerid) {
//              SendClientMessage(playerid, COLOR_RED, "You need to be the gang leader to send an invite.");
//              return 1;
//          }

            if(IsPlayerConnected(giveplayerid))
            {
                GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                GetPlayerName(playerid, sendername, sizeof(sendername));

                format(string, sizeof(string),"You have sent a gang invite to %s.", giveplayer);
                SendClientMessage(playerid, COLOR_GREEN, string);
                format(string, sizeof(string),"You have recieved a gang invite from %s to '%s' (id: %d)", sendername, gangNames[playerGang[playerid]],playerGang[playerid]);
                SendClientMessage(giveplayerid, COLOR_GREEN, string);

                gangInvite[giveplayerid]=playerGang[playerid];

            }
            else return SendClientMessage(playerid, COLOR_RED, "No such player exists!");

        //Leave Gang//
        }
        else if (gangcmd==4) return PlayerLeaveGang(playerid);
        }

        return 1;
    }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)