How could I make this work; 0 Erros
#1

pawn Код:
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT

#include <a_samp>
forward PlayerLeaveGang(playerid);
#if defined FILTERSCRIPT
#define MAX_GANGS           32
#define MAX_GANG_MEMBERS    6
#define MAX_GANG_NAME       16
new gangMembers[MAX_GANGS][MAX_GANG_MEMBERS];
new gangNames[MAX_GANGS][MAX_GANG_NAME];
new gangInfo[MAX_GANGS][3]; //0-created,1-members,2-color
new gangBank[MAX_GANGS];
new playerGang[MAX_PLAYERS];
new gangInvite[MAX_PLAYERS];
new gActivePlayers[MAX_PLAYERS];
new gLastGaveCash[MAX_PLAYERS];


public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print(" Blank Filterscript by your name here");
    print("--------------------------------------\n");
    return 1;
}

public OnFilterScriptExit()
{
    return 1;
}
public PlayerLeaveGang(playerid) {
    new string[256];
    new playername[MAX_PLAYER_NAME];
    new gangnum = playerGang[playerid];

    if(gangnum > 0) {
        for(new i = 0; i < gangInfo[gangnum][1]; i++) {
            if(gangMembers[gangnum][i]==playerid) {

                //One less gang member
                gangInfo[gangnum][1]--;

                for(new j = i; j < gangInfo[gangnum][1]; j++) {
                    //Shift gang members
                    gangMembers[gangnum][j]=gangMembers[gangnum][j+1];
                }

                //Disband gang if no more members
                if(gangInfo[gangnum][1]<1) {
                    gangInfo[gangnum][0]=0;
                    gangInfo[gangnum][1]=0;
                    gangBank[gangnum]=0;
                }

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

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

                playerGang[playerid]=0;

                SetPlayerColor(playerid,playerColors[playerid]);

                return;
            }
        }
    } else {
        SendClientMessage(playerid, COLOR_RED, "You are not in a gang.");
    }
}

public getCheckpointType(playerID) {
    return checkpointType[playerCheckpoint[playerID]];
}

public isPlayerInArea(playerID, Float:data[4])
{
    new Float:X, Float:Y, Float:Z;

    GetPlayerPos(playerID, X, Y, Z);
    if(X >= data[0] && X <= data[2] && Y >= data[1] && Y <= data[3]) {
        return 1;
    }
    return 0;
}

public PayPlayerInArea(playerID, Float:x1, Float:y1, Float:x2, Float:y2, cash)
{

    if(IsPlayerConnected(playerID))
    {
        new Float:X, Float:Y, Float:Z;

        GetPlayerPos(playerID, X, Y, Z);
        if(X >= x1 && X <= x2 && Y >= y1 && Y <= y2)
        {
            GivePlayerMoney(playerID, cash);
            return 1;
        }
    }
    return 0;
}

#else

main()
{
    print("\n----------------------------------");
    print(" Blank Gamemode by your name here");
    print("----------------------------------\n");
}

#endif

public OnGameModeInit()
{
    // Don't use these lines if it's a filterscript
    SetGameModeText("Blank Script");
    AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    return 1;
}

public OnGameModeExit()
{
    return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
    SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
    return 1;
}

public OnPlayerConnect(playerid)
{
    gActivePlayers[playerid]++;
    gLastGaveCash[playerid] = GetTickCount();

    playerCheckpoint[playerid]=999;
    bank[playerid]=0;
    playerGang[playerid]=0;
    gangInvite[playerid]=0;

    GetPlayerName(playerid, playrname, sizeof(playrname));
    for(new i = 0; i < MAX_SAVE; i++) {

        if(isStringSame(savedNames[i], playrname, MAX_PLAYER_NAME)) {
            GivePlayerMoney(playerid, savedInfo[i][0]);
            bank[playerid] = savedInfo[i][1];
            bounty[playerid] = savedInfo[i][2];

            savedInfo[i][0]=savedInfo[i][1]=savedInfo[i][2]=0;
            savedNames[i][0]=0;

            for(new j = 0; j < MAX_WEAPONS; j++) {
                playerWeapons[playerid][j]=savedWeapons[i][j];
                savedWeapons[i][j]=0;
            }

            SendClientMessage(playerid, COLOR_GREEN, "Your money has been restored.");
            }
        }

    PLAYERLIST_authed[playerid]=false;
    return false;
}

public OnPlayerDisconnect(playerid, reason)
{
    new playername[MAX_PLAYER_NAME];

    gActivePlayers[playerid]--;

    for(new i = 0; i < MAX_PROPERTIES; i++) {
        if(propertyOwner[i]==playerid) {
            propertyOwner[i] = 999;
            GivePlayerMoney(playerid, propertyValues[i]);
        }
    }

    //Save temp info for timeouts/crashes
    GetPlayerName(playerid, playername, sizeof(playername));
    format(savedNames[savePos], MAX_PLAYER_NAME, "%s",playername);

    savedInfo[savePos][0] = GetPlayerMoney(playerid);
    savedInfo[savePos][1] = bank[playerid];
    savedInfo[savePos][2] = bounty[playerid];
    savedInfo[savePos][3] = 0;

    for(new i = 0; i < MAX_WEAPONS; i++)
        savedWeapons[savePos][i]=playerWeapons[playerid][i];
    //
    savePos++;
    if(savePos >= MAX_SAVE)
        savePos = 0;

    PlayerLeaveGang(playerid);
    bounty[playerid] = 0;

    for(new i = 0; i < MAX_WEAPONS;i++) {
        playerWeapons[playerid][i]=0;
    }

  if (PLAYERLIST_authed[playerid]) {
     // Was loggedin, so save the data!
    dUserSetINT(PlayerName(playerid)).("money",GetPlayerMoney(playerid));
  }
  PLAYERLIST_authed[playerid]=false;
  return false;
}
    return 1;
}

public OnPlayerSpawn(playerid)
{
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    new playercash;
    new killedplayer[MAX_PLAYER_NAME];
    new string[256];

    playercash = GetPlayerMoney(playerid);

    if(killerid == INVALID_PLAYER_ID)
    {
        SendDeathMessage(INVALID_PLAYER_ID,playerid,reason);
    }
     else
    {
        SendDeathMessage(killerid,playerid,reason);
        SetPlayerScore(killerid,GetPlayerScore(killerid)+1);
        if(bounty[playerid] > 0 && (playerGang[killerid] == 0 || playerGang[playerid] != playerGang[killerid])) {
            GetPlayerName(playerid, killedplayer, sizeof(killedplayer));
            format(string, sizeof(string), "You earned a bounty of %d for killing %s.", bounty[playerid], killedplayer);
            SendClientMessage(killerid, COLOR_GREEN, string);

            GivePlayerMoney(killerid, bounty[playerid]);
            bounty[playerid] = 0;
        }
        if(playercash > 0)  {
            GivePlayerMoney(killerid, playercash);
        }
    }

    if(playercash > 0)
    {
        ResetPlayerMoney(playerid);
    }
    return 1;
}

public OnVehicleSpawn(vehicleid)
{
    return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
    return 1;
}
public OnPlayerText(playerid, text[])
{
    if(text[0] == '!') {
        if(playerGang[playerid] > 0) {
            new gangChat[256];
            new senderName[MAX_PLAYER_NAME];
            new string[256];

//          for(new i = 1; i < strlen(text)+1; i++)
//              gangChat[i]=text[i];

            strmid(gangChat,text,1,strlen(text));

            GetPlayerName(playerid, senderName, sizeof(senderName));
            format(string, sizeof(string),"%s: %s", senderName, gangChat);

            for(new i = 0; i < gangInfo[playerGang[playerid]][1]; i++) {
                SendClientMessage(gangMembers[playerGang[playerid]][i], COLOR_LIGHTBLUE, string);
            }
        }

        return 0;
    }
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmd, "/gangcommands", true) == 0) {
        SendClientMessage(playerid, COLOR_GREEN,"Gang commands:");
        SendClientMessage(playerid, COLOR_YELLOW,"/gang create [name]");
        SendClientMessage(playerid, COLOR_YELLOW,"/gang join");
        SendClientMessage(playerid, COLOR_YELLOW,"/gang invite [playerID]");
        SendClientMessage(playerid, COLOR_YELLOW,"/gang quit");
        SendClientMessage(playerid, COLOR_YELLOW,"/ganginfo [number] (no number given shows your gang's info)");
        SendClientMessage(playerid, COLOR_YELLOW,"/gbank [money] /gwithdraw [money] /gbalance");
        SendClientMessage(playerid, COLOR_YELLOW,"! (prefix text for gang-chat)");
        return 1;
    }
    if(strcmp(cmd, "/bank", true) == 0 || strcmp(cmd, "/gbank", true) == 0) {
        new gang;
        if(strcmp(cmd, "/gbank", true) == 0)
            gang = 1;

            return 1;
        }

        if(gang && playerGang[playerid]==0) {
            SendClientMessage(playerid, COLOR_RED, "You are not in a gang!");
            return 1;
        }

        new tmp[256];
        tmp = strtok(cmdtext, idx);

        if(!strlen(tmp)) {
            SendClientMessage(playerid, COLOR_WHITE, "USAGE: /(g)bank [amount]");
            return 1;
        }
        moneys = strval(tmp);

        if(moneys < 1) {
            SendClientMessage(playerid, COLOR_YELLOW, "Incorrect Amount.");
            return 1;
        }

        if(GetPlayerMoney(playerid) < moneys) {
            moneys = GetPlayerMoney(playerid);
        }

        GivePlayerMoney(playerid, 0-moneys);

        if(gang)
            gangBank[playerGang[playerid]]+=moneys;
        else
            bank[playerid]+=moneys;

        if(gang)
            format(string, sizeof(string), "You have deposited $%d, your gang's balance is $%d.", moneys, gangBank[playerGang[playerid]]);
        else
            format(string, sizeof(string), "You have deposited $%d, your current balance is $%d.", moneys, bank[playerid]);

        SendClientMessage(playerid, COLOR_YELLOW, string);

        return 1;
    }
        if(strcmp(cmd, "/withdraw", true) == 0 || strcmp(cmd, "/gwithdraw", true) == 0) {
        new gang;

            return 1;
        }

        if(strcmp(cmd, "/gwithdraw", true) == 0)
            gang = 1;

        if(gang && playerGang[playerid]==0) {
            SendClientMessage(playerid, COLOR_RED, "You are not in a gang!");
            return 1;
        }

        new tmp[256];
        tmp = strtok(cmdtext, idx);

        if(!strlen(tmp)) {
            SendClientMessage(playerid, COLOR_WHITE, "USAGE: /(g)withdraw [amount]");
            return 1;
        }
        moneys = strval(tmp);

        if(moneys < 1) {
            SendClientMessage(playerid, COLOR_YELLOW, "Hey what are you trying to pull here.");
            return 1;
        }

        if(gang) {
            if(moneys > gangBank[playerGang[playerid]])
                moneys = gangBank[playerGang[playerid]];
        } else {
            if(moneys > bank[playerid])
                moneys = bank[playerid];
        }

        GivePlayerMoney(playerid, moneys);
        if(gang)
            gangBank[playerGang[playerid]] -= moneys;
        else
            bank[playerid] -= moneys;

        if(gang)
            format(string, sizeof(string), "You have withdrawn $%d, your gang's balance is $%d.", moneys, gangBank[playerGang[playerid]]);
        else
            format(string, sizeof(string), "You have withdrawn $%d, your current balance is $%d.", moneys, bank[playerid]);
        SendClientMessage(playerid, COLOR_YELLOW, string);

        return 1;
    }

    //------------------- /balance

    if(strcmp(cmd, "/balance", true) == 0 || strcmp(cmd, "/gbalance", true) == 0) {
        new gang;
        if(strcmp(cmd, "/gbalance", true) == 0)
            gang = 1;

            return 1;
        }

        if(gang && playerGang[playerid]==0) {
            SendClientMessage(playerid, COLOR_RED, "You are not in a gang!");
            return 1;
        }

        if(gang)
            format(string, sizeof(string), "Your gang has $%d in the bank.", gangBank[playerGang[playerid]]);
        else
            format(string, sizeof(string), "You have $%d in the bank.", bank[playerid]);
        SendClientMessage(playerid, COLOR_YELLOW, string);

        return 1;
    }
    if(strcmp(cmd, "/hitman", true) == 0) {
        new tmp[256];
        tmp = strtok(cmdtext, idx);

        if(!strlen(tmp)) {
            SendClientMessage(playerid, COLOR_WHITE, "USAGE: /hitman [playerid] [amount]");
            return 1;
        }
        giveplayerid = strval(tmp);

        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp)) {
            SendClientMessage(playerid, COLOR_WHITE, "USAGE: /hitman [playerid] [amount]");
            return 1;
        }
        moneys = strval(tmp);

        if(moneys > GetPlayerMoney(playerid)) {
            SendClientMessage(playerid, COLOR_RED, "You don't have enough money!");
            return 1;
        }
        if(moneys < 1) {
            SendClientMessage(playerid, COLOR_YELLOW, "Hey what are you trying to pull here.");
            return 1;
        }
        if(IsPlayerConnected(giveplayerid)==0) {
            SendClientMessage(playerid, COLOR_RED, "No such player exists.");
            return 1;
        }

        bounty[giveplayerid]+=moneys;
        GivePlayerMoney(playerid, 0-moneys);

        GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
        GetPlayerName(playerid, sendername, sizeof(sendername));

        format(string, sizeof(string), "You have put a $%d bounty on the head of %s (id: %d).", moneys, giveplayer,giveplayerid);
        SendClientMessage(playerid, COLOR_YELLOW, string);

        format(string, sizeof(string), "%s has had a $%d bounty put on his head from %s (total: $%d).", giveplayer, moneys, sendername, bounty[giveplayerid]);
        SendClientMessageToAll(COLOR_ORANGE, string);

        format(string, sizeof(string), "You have had a $%d bounty put on you from %s (id: %d).", moneys, sendername, playerid);
        SendClientMessage(giveplayerid, COLOR_RED, string);

        return 1;
    }
        if(strcmp(cmd, "/bounty", true) == 0) {
        new tmp[256];
        tmp = strtok(cmdtext, idx);

        if(!strlen(tmp)) {
            SendClientMessage(playerid, COLOR_WHITE, "USAGE: /bounty [playerid]");
            return 1;
        }
        giveplayerid = strval(tmp);

        if(IsPlayerConnected(giveplayerid)) {
            GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
            format(string, sizeof(string), "Player %s (id: %d) has a  $%d bounty on his head.", giveplayer,giveplayerid,bounty[giveplayerid]);
            SendClientMessage(playerid, COLOR_YELLOW, string);
        } else {
            SendClientMessage(playerid, COLOR_RED, "No such player exists!");
        }

        return 1;
    }

    //------------------- /bounties

    if(strcmp(cmd, "/bounties", true) == 0)
    {
//      new tmp[256];
        new x;

        SendClientMessage(playerid, COLOR_GREEN, "Current Bounties:");
        for(new i=0; i < MAX_PLAYERS; i++) {
            if(IsPlayerConnected(i) && bounty[i] > 0) {
                GetPlayerName(i, giveplayer, sizeof(giveplayer));
                format(string, sizeof(string), "%s%s(%d): $%d", string,giveplayer,i,bounty[i]);

                x++;
                if(x > 3) {
                    SendClientMessage(playerid, COLOR_YELLOW, string);
                    x = 0;
                    format(string, sizeof(string), "");
                } else {
                    format(string, sizeof(string), "%s, ", string);
                }
            }
        }

        if(x <= 3 && x > 0) {
            string[strlen(string)-2] = '.';
            SendClientMessage(playerid, COLOR_YELLOW, string);
        }

        return 1;
    }
    if(strcmp(cmd, "/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;
    }

    //------------------- /ganginfo

    if(strcmp(cmd, "/ganginfo", true) == 0) {
        new tmp[256];
        new gangnum;
        tmp = strtok(cmdtext, idx);

        if(!strlen(tmp) && playerGang[playerid]==0) {
            SendClientMessage(playerid, COLOR_WHITE, "USAGE: /ganginfo [number]");
            return 1;
        } else if (!strlen(tmp))
            gangnum = playerGang[playerid];
        else
            gangnum = strval(tmp);

        if(gangInfo[gangnum][0]==0) {
            SendClientMessage(playerid, COLOR_RED, "No such gang exists!");
            return 1;
        }

        format(string, sizeof(string),"'%s' Gang Members (id: %d)", gangNames[gangnum], gangnum);
        SendClientMessage(playerid, COLOR_GREEN, string);

        for(new i = 0; i < gangInfo[gangnum][1]; i++) {
            GetPlayerName(gangMembers[gangnum][i], giveplayer, sizeof(giveplayer));
            format(string, sizeof(string),"%s (%d)", giveplayer, gangMembers[gangnum][i]);
            SendClientMessage(playerid, COLOR_YELLOW, string);
        }

        return 1;
    }

    //------------------- /gangs

    if(strcmp(cmd, "/gangs", true) == 0)
    {
        new x;

        SendClientMessage(playerid, COLOR_GREEN, "Current Gangs:");
        for(new i=0; i < MAX_GANGS; i++) {
            if(gangInfo[i][0]==1) {
                format(string, sizeof(string), "%s%s(%d) - %d members", string,gangNames[i],i,gangInfo[i][1]);

                x++;
                if(x > 2) {
                    SendClientMessage(playerid, COLOR_YELLOW, string);
                    x = 0;
                    format(string, sizeof(string), "");
                } else {
                    format(string, sizeof(string), "%s, ", string);
                }
            }
        }

        if(x <= 2 && x > 0) {
            string[strlen(string)-2] = '.';
            SendClientMessage(playerid, COLOR_YELLOW, string);
        }

        return 1;
    }

    //------------------- /givecash

    return 0;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
    return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
    return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
    return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
    return 1;
}

public OnPlayerLeaveRaceCheckpoint(playerid)
{
    return 1;
}

public OnRconCommand(cmd[])
{
    return 1;
}

public OnPlayerRequestSpawn(playerid)
{
    return 1;
}

public OnObjectMoved(objectid)
{
    return 1;
}

public OnPlayerObjectMoved(playerid, objectid)
{
    return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
    return 1;
}

public OnVehicleMod(playerid, vehicleid, componentid)
{
    return 1;
}

public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
    return 1;
}

public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
    return 1;
}

public OnPlayerSelectedMenuRow(playerid, row)
{
    return 1;
}

public OnPlayerExitedMenu(playerid)
{
    return 1;
}

public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
    return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    return 1;
}

public OnRconLoginAttempt(ip[], password[], success)
{
    return 1;
}

public OnPlayerUpdate(playerid)
{
    return 1;
}

public OnPlayerStreamIn(playerid, forplayerid)
{
    return 1;
}

public OnPlayerStreamOut(playerid, forplayerid)
{
    return 1;
}

public OnVehicleStreamIn(vehicleid, forplayerid)
{
    return 1;
}

public OnVehicleStreamOut(vehicleid, forplayerid)
{
    return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    return 1;
}

public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
    return 1;
}
Errors:
pawn Код:
C:\Users\hassane\Desktop\Gang.pwn(145) : error 017: undefined symbol "gActivePlayers"
C:\Users\hassane\Desktop\Gang.pwn(145) : warning 215: expression has no effect
C:\Users\hassane\Desktop\Gang.pwn(145) : error 001: expected token: ";", but found "]"
C:\Users\hassane\Desktop\Gang.pwn(145) : error 029: invalid expression, assumed zero
C:\Users\hassane\Desktop\Gang.pwn(145) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.
Can I anyone fix them? I tryed for 2 hours, no changes.
Reply
#2

pawn Код:
new gActivePlayers[MAX_PLAYERS];
Reply
#3

<What are you trying to say?
Reply
#4

Please answer!!
Reply
#5

He is trying to say/tell you the code to fix your problem lol! Just put that @ top of your script...
Reply
#6

It's already there, lol?
Reply
#7

Remove these lines

pawn Код:
#if defined FILTERSCRIPT
pawn Код:
#else
pawn Код:
#endif
Reply
#8

pawn Код:
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT

#include <a_samp>
#define dcmd(%1,%2,%3) if ((strcmp(%3, "/%1", true, %2+1) == 0)&&(((%3[%2+1]==0)&&(dcmd_%1(playerid,"")))||((%3[%2+1]==32)&&(dcmd_%1(playerid,%3[%2+2]))))) return 1
#define COLOR_SYSTEM 0xEFEFF7AA

#define COLOR_GREY 0xAFAFAFAA
#define COLOR_GREEN 0x33AA33AA
#define COLOR_RED 0xAA3333AA
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_BLUE 0x0000BBAA
#define COLOR_LIGHTBLUE 0x33CCFFAA
#define COLOR_ORANGE 0xFF9900AA
#define NUMVALUES 4

forward PlayerLeaveGang(playerid);
forward getCheckpointType(playerID);
#define MAX_GANGS           32
#define MAX_GANG_MEMBERS    6
#define MAX_GANG_NAME       16
#define MAX_POINTS 11
#define CP_BANK     0
#define CP_PIRATE   1
#define CP_AMMU     2
#define CP_DRAGON   3
#define CP_SEXSHOP  4
#define CP_BAR      5
#define CP_CALIGULA 6
#define CP_ZIP      7
#define CP_BINCO    8
#define CP_TATOO    9
#define CP_BOTIQUE  10

#define P_DRAGON    0
#define P_SEXSHOP   1
#define P_BAR       2
#define P_CALIGULA  3
#define P_ZIP       4
#define P_BINCO     5
#define P_TATOO     6
#define P_BOTIQUE   7
#define P_OFFSET    3
new gangMembers[MAX_GANGS][MAX_GANG_MEMBERS];
new gangNames[MAX_GANGS][MAX_GANG_NAME];
new gangInfo[MAX_GANGS][3]; //0-created,1-members,2-color
new gangBank[MAX_GANGS];
new playerGang[MAX_PLAYERS];
new gangInvite[MAX_PLAYERS];
new gActivePlayers[MAX_PLAYERS];
new gLastGaveCash[MAX_PLAYERS];
new playerCheckpoint[MAX_PLAYERS];
new bank[MAX_PLAYERS];
new playerColors[100] = {
0xFF8C13FF,0xC715FFFF,0x20B2AAFF,0xDC143CFF,0x6495EDFF,0xf0e68cFF,0x778899FF,0xFF1493FF,0xF4A460FF,0xEE82EEFF,0xFFD720FF,
0x8b4513FF,0x4949A0FF,0x148b8bFF,0x14ff7fFF,0x556b2fFF,0x0FD9FAFF,0x10DC29FF,0x534081FF,0x0495CDFF,0xEF6CE8FF,0xBD34DAFF,
0x247C1BFF,0x0C8E5DFF,0x635B03FF,0xCB7ED3FF,0x65ADEBFF,0x5C1ACCFF,0xF2F853FF,0x11F891FF,0x7B39AAFF,0x53EB10FF,0x54137DFF,
0x275222FF,0xF09F5BFF,0x3D0A4FFF,0x22F767FF,0xD63034FF,0x9A6980FF,0xDFB935FF,0x3793FAFF,0x90239DFF,0xE9AB2FFF,0xAF2FF3FF,
0x057F94FF,0xB98519FF,0x388EEAFF,0x028151FF,0xA55043FF,0x0DE018FF,0x93AB1CFF,0x95BAF0FF,0x369976FF,0x18F71FFF,0x4B8987FF,
0x491B9EFF,0x829DC7FF,0xBCE635FF,0xCEA6DFFF,0x20D4ADFF,0x2D74FDFF,0x3C1C0DFF,0x12D6D4FF,0x48C000FF,0x2A51E2FF,0xE3AC12FF,
0xFC42A8FF,0x2FC827FF,0x1A30BFFF,0xB740C2FF,0x42ACF5FF,0x2FD9DEFF,0xFAFB71FF,0x05D1CDFF,0xC471BDFF,0x94436EFF,0xC1F7ECFF,
0xCE79EEFF,0xBD1EF2FF,0x93B7E4FF,0x3214AAFF,0x184D3BFF,0xAE4B99FF,0x7E49D7FF,0x4C436EFF,0xFA24CCFF,0xCE76BEFF,0xA04E0AFF,
0x9F945CFF,0xDCDE3DFF,0x10C9C5FF,0x70524DFF,0x0BE472FF,0x8A2CD7FF,0x6152C2FF,0xCF72A9FF,0xE59338FF,0xEEDC2DFF,0xD8C762FF,
0x3FE65CFF
};
new Float:checkpoints[MAX_POINTS][3] = {
{-22.2549,-55.6575,1003.5469},
{2000.3132,1538.6012,13.5859},
{291.0004,-84.5168,1001.5156},
{1989.0619,1005.5241,994.4688},
{-103.5525,-22.4661,1000.7188},
{501.4927,-75.4323,998.7578},
{2235.5408,1679.0402,1008.3594},
{161.1875,-79.9915,1001.8047},
{207.5640,-97.8188,1005.2578},
{-203.4864,-41.2045,1002.2734},
{418.5547,-80.1667,1001.8047}
};

new checkpointType[MAX_POINTS] = {
    CP_BANK,
    CP_PIRATE,
    CP_AMMU,
    CP_DRAGON,
    CP_SEXSHOP,
    CP_BAR,
    CP_CALIGULA,
    CP_ZIP,
    CP_BINCO,
    CP_TATOO,
    CP_BOTIQUE
};


public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print(" Blank Filterscript by your name here");
    print("--------------------------------------\n");
    return 1;
}

public OnFilterScriptExit()
{
    return 1;
}
public PlayerLeaveGang(playerid) {
    new string[256];
    new playername[MAX_PLAYER_NAME];
    new gangnum = playerGang[playerid];

    if(gangnum > 0) {
        for(new i = 0; i < gangInfo[gangnum][1]; i++) {
            if(gangMembers[gangnum][i]==playerid) {

                //One less gang member
                gangInfo[gangnum][1]--;

                for(new j = i; j < gangInfo[gangnum][1]; j++) {
                    //Shift gang members
                    gangMembers[gangnum][j]=gangMembers[gangnum][j+1];
                }

                //Disband gang if no more members
                if(gangInfo[gangnum][1]<1) {
                    gangInfo[gangnum][0]=0;
                    gangInfo[gangnum][1]=0;
                    gangBank[gangnum]=0;
                }

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

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

                playerGang[playerid]=0;

                SetPlayerColor(playerid,playerColors[playerid]);

                return;
            }
        }
    } else {
        SendClientMessage(playerid, COLOR_RED, "You are not in a gang.");
    }
}

public getCheckpointType(playerID) {
    return checkpointType[playerCheckpoint[playerID]];
}

public isPlayerInArea(playerID, Float:data[4])
{
    new Float:X, Float:Y, Float:Z;

    GetPlayerPos(playerID, X, Y, Z);
    if(X >= data[0] && X <= data[2] && Y >= data[1] && Y <= data[3]) {
        return 1;
    }
    return 0;
}

public PayPlayerInArea(playerID, Float:x1, Float:y1, Float:x2, Float:y2, cash)
{

    if(IsPlayerConnected(playerID))
    {
        new Float:X, Float:Y, Float:Z;

        GetPlayerPos(playerID, X, Y, Z);
        if(X >= x1 && X <= x2 && Y >= y1 && Y <= y2)
        {
            GivePlayerMoney(playerID, cash);
            return 1;
        }
    }
    return 0;
}


main()
{
    print("\n----------------------------------");
    print(" Blank Gamemode by your name here");
    print("----------------------------------\n");
}

public OnGameModeInit()
{
    // Don't use these lines if it's a filterscript
    SetGameModeText("Blank Script");
    AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    return 1;
}

public OnGameModeExit()
{
    return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
    SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
    return 1;
}

public OnPlayerConnect(playerid)
{
    gActivePlayers[MAX_PLAYERS];
    gLastGaveCash[MAX_PLAYERS]; = GetTickCount();

    playerCheckpoint[playerid]=999;
    bank[playerid]=0;
    playerGang[playerid]=0;
    gangInvite[playerid]=0;

    GetPlayerName(playerid, playrname, sizeof(playrname));
    for(new i = 0; i < MAX_SAVE; i++) {

        if(isStringSame(savedNames[i], playrname, MAX_PLAYER_NAME)) {
            GivePlayerMoney(playerid, savedInfo[i][0]);
            bank[playerid] = savedInfo[i][1];
            bounty[playerid] = savedInfo[i][2];

            savedInfo[i][0]=savedInfo[i][1]=savedInfo[i][2]=0;
            savedNames[i][0]=0;

            for(new j = 0; j < MAX_WEAPONS; j++) {
                playerWeapons[playerid][j]=savedWeapons[i][j];
                savedWeapons[i][j]=0;
            }

            SendClientMessage(playerid, COLOR_GREEN, "Your money has been restored.");
            }
        }

    PLAYERLIST_authed[playerid]=false;
    return false;
}

public OnPlayerDisconnect(playerid, reason)
{
    new playername[MAX_PLAYER_NAME];

    gActivePlayers[playerid]--;

    for(new i = 0; i < MAX_PROPERTIES; i++) {
        if(propertyOwner[i]==playerid) {
            propertyOwner[i] = 999;
            GivePlayerMoney(playerid, propertyValues[i]);
        }
    }

    //Save temp info for timeouts/crashes
    GetPlayerName(playerid, playername, sizeof(playername));
    format(savedNames[savePos], MAX_PLAYER_NAME, "%s",playername);

    savedInfo[savePos][0] = GetPlayerMoney(playerid);
    savedInfo[savePos][1] = bank[playerid];
    savedInfo[savePos][2] = bounty[playerid];
    savedInfo[savePos][3] = 0;

    for(new i = 0; i < MAX_WEAPONS; i++)
        savedWeapons[savePos][i]=playerWeapons[playerid][i];
    //
    savePos++;
    if(savePos >= MAX_SAVE)
        savePos = 0;

    PlayerLeaveGang(playerid);
    bounty[playerid] = 0;

    for(new i = 0; i < MAX_WEAPONS;i++) {
        playerWeapons[playerid][i]=0;
    }

  if (PLAYERLIST_authed[playerid]) {
     // Was loggedin, so save the data!
    dUserSetINT(PlayerName(playerid)).("money",GetPlayerMoney(playerid));
  }
  PLAYERLIST_authed[playerid]=false;
  return false;
}
    return 1;
}

public OnPlayerSpawn(playerid)
{
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    new playercash;
    new killedplayer[MAX_PLAYER_NAME];
    new string[256];

    playercash = GetPlayerMoney(playerid);

    if(killerid == INVALID_PLAYER_ID)
    {
        SendDeathMessage(INVALID_PLAYER_ID,playerid,reason);
    }
     else
    {
        SendDeathMessage(killerid,playerid,reason);
        SetPlayerScore(killerid,GetPlayerScore(killerid)+1);
        if(bounty[playerid] > 0 && (playerGang[killerid] == 0 || playerGang[playerid] != playerGang[killerid])) {
            GetPlayerName(playerid, killedplayer, sizeof(killedplayer));
            format(string, sizeof(string), "You earned a bounty of %d for killing %s.", bounty[playerid], killedplayer);
            SendClientMessage(killerid, COLOR_GREEN, string);

            GivePlayerMoney(killerid, bounty[playerid]);
            bounty[playerid] = 0;
        }
        if(playercash > 0)  {
            GivePlayerMoney(killerid, playercash);
        }
    }

    if(playercash > 0)
    {
        ResetPlayerMoney(playerid);
    }
    return 1;
}

public OnVehicleSpawn(vehicleid)
{
    return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
    return 1;
}
public OnPlayerText(playerid, text[])
{
    if(text[0] == '!') {
        if(playerGang[playerid] > 0) {
            new gangChat[256];
            new senderName[MAX_PLAYER_NAME];
            new string[256];

//          for(new i = 1; i < strlen(text)+1; i++)
//              gangChat[i]=text[i];

            strmid(gangChat,text,1,strlen(text));

            GetPlayerName(playerid, senderName, sizeof(senderName));
            format(string, sizeof(string),"%s: %s", senderName, gangChat);

            for(new i = 0; i < gangInfo[playerGang[playerid]][1]; i++) {
                SendClientMessage(gangMembers[playerGang[playerid]][i], COLOR_LIGHTBLUE, string);
            }
        }

        return 0;
    }
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmd, "/gangcommands", true) == 0) {
        SendClientMessage(playerid, COLOR_GREEN,"Gang commands:");
        SendClientMessage(playerid, COLOR_YELLOW,"/gang create [name]");
        SendClientMessage(playerid, COLOR_YELLOW,"/gang join");
        SendClientMessage(playerid, COLOR_YELLOW,"/gang invite [playerID]");
        SendClientMessage(playerid, COLOR_YELLOW,"/gang quit");
        SendClientMessage(playerid, COLOR_YELLOW,"/ganginfo [number] (no number given shows your gang's info)");
        SendClientMessage(playerid, COLOR_YELLOW,"/gbank [money] /gwithdraw [money] /gbalance");
        SendClientMessage(playerid, COLOR_YELLOW,"! (prefix text for gang-chat)");
        return 1;
    }
    if(strcmp(cmd, "/bank", true) == 0 || strcmp(cmd, "/gbank", true) == 0) {
        new gang;
        if(strcmp(cmd, "/gbank", true) == 0)
            gang = 1;

            return 1;
        }

        if(gang && playerGang[playerid]==0) {
            SendClientMessage(playerid, COLOR_RED, "You are not in a gang!");
            return 1;
        }

        new tmp[256];
        tmp = strtok(cmdtext, idx);

        if(!strlen(tmp)) {
            SendClientMessage(playerid, COLOR_WHITE, "USAGE: /(g)bank [amount]");
            return 1;
        }
        moneys = strval(tmp);

        if(moneys < 1) {
            SendClientMessage(playerid, COLOR_YELLOW, "Incorrect Amount.");
            return 1;
        }

        if(GetPlayerMoney(playerid) < moneys) {
            moneys = GetPlayerMoney(playerid);
        }

        GivePlayerMoney(playerid, 0-moneys);

        if(gang)
            gangBank[playerGang[playerid]]+=moneys;
        else
            bank[playerid]+=moneys;

        if(gang)
            format(string, sizeof(string), "You have deposited $%d, your gang's balance is $%d.", moneys, gangBank[playerGang[playerid]]);
        else
            format(string, sizeof(string), "You have deposited $%d, your current balance is $%d.", moneys, bank[playerid]);

        SendClientMessage(playerid, COLOR_YELLOW, string);

        return 1;
    }
        if(strcmp(cmd, "/withdraw", true) == 0 || strcmp(cmd, "/gwithdraw", true) == 0) {
        new gang;

            return 1;
        }

        if(strcmp(cmd, "/gwithdraw", true) == 0)
            gang = 1;

        if(gang && playerGang[playerid]==0) {
            SendClientMessage(playerid, COLOR_RED, "You are not in a gang!");
            return 1;
        }

        new tmp[256];
        tmp = strtok(cmdtext, idx);

        if(!strlen(tmp)) {
            SendClientMessage(playerid, COLOR_WHITE, "USAGE: /(g)withdraw [amount]");
            return 1;
        }
        moneys = strval(tmp);

        if(moneys < 1) {
            SendClientMessage(playerid, COLOR_YELLOW, "Hey what are you trying to pull here.");
            return 1;
        }

        if(gang) {
            if(moneys > gangBank[playerGang[playerid]])
                moneys = gangBank[playerGang[playerid]];
        } else {
            if(moneys > bank[playerid])
                moneys = bank[playerid];
        }

        GivePlayerMoney(playerid, moneys);
        if(gang)
            gangBank[playerGang[playerid]] -= moneys;
        else
            bank[playerid] -= moneys;

        if(gang)
            format(string, sizeof(string), "You have withdrawn $%d, your gang's balance is $%d.", moneys, gangBank[playerGang[playerid]]);
        else
            format(string, sizeof(string), "You have withdrawn $%d, your current balance is $%d.", moneys, bank[playerid]);
        SendClientMessage(playerid, COLOR_YELLOW, string);

        return 1;
    }

    //------------------- /balance

    if(strcmp(cmd, "/balance", true) == 0 || strcmp(cmd, "/gbalance", true) == 0) {
        new gang;
        if(strcmp(cmd, "/gbalance", true) == 0)
            gang = 1;

            return 1;
        }

        if(gang && playerGang[playerid]==0) {
            SendClientMessage(playerid, COLOR_RED, "You are not in a gang!");
            return 1;
        }

        if(gang)
            format(string, sizeof(string), "Your gang has $%d in the bank.", gangBank[playerGang[playerid]]);
        else
            format(string, sizeof(string), "You have $%d in the bank.", bank[playerid]);
        SendClientMessage(playerid, COLOR_YELLOW, string);

        return 1;
    }
    if(strcmp(cmd, "/hitman", true) == 0) {
        new tmp[256];
        tmp = strtok(cmdtext, idx);

        if(!strlen(tmp)) {
            SendClientMessage(playerid, COLOR_WHITE, "USAGE: /hitman [playerid] [amount]");
            return 1;
        }
        giveplayerid = strval(tmp);

        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp)) {
            SendClientMessage(playerid, COLOR_WHITE, "USAGE: /hitman [playerid] [amount]");
            return 1;
        }
        moneys = strval(tmp);

        if(moneys > GetPlayerMoney(playerid)) {
            SendClientMessage(playerid, COLOR_RED, "You don't have enough money!");
            return 1;
        }
        if(moneys < 1) {
            SendClientMessage(playerid, COLOR_YELLOW, "Hey what are you trying to pull here.");
            return 1;
        }
        if(IsPlayerConnected(giveplayerid)==0) {
            SendClientMessage(playerid, COLOR_RED, "No such player exists.");
            return 1;
        }

        bounty[giveplayerid]+=moneys;
        GivePlayerMoney(playerid, 0-moneys);

        GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
        GetPlayerName(playerid, sendername, sizeof(sendername));

        format(string, sizeof(string), "You have put a $%d bounty on the head of %s (id: %d).", moneys, giveplayer,giveplayerid);
        SendClientMessage(playerid, COLOR_YELLOW, string);

        format(string, sizeof(string), "%s has had a $%d bounty put on his head from %s (total: $%d).", giveplayer, moneys, sendername, bounty[giveplayerid]);
        SendClientMessageToAll(COLOR_ORANGE, string);

        format(string, sizeof(string), "You have had a $%d bounty put on you from %s (id: %d).", moneys, sendername, playerid);
        SendClientMessage(giveplayerid, COLOR_RED, string);

        return 1;
    }
        if(strcmp(cmd, "/bounty", true) == 0) {
        new tmp[256];
        tmp = strtok(cmdtext, idx);

        if(!strlen(tmp)) {
            SendClientMessage(playerid, COLOR_WHITE, "USAGE: /bounty [playerid]");
            return 1;
        }
        giveplayerid = strval(tmp);

        if(IsPlayerConnected(giveplayerid)) {
            GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
            format(string, sizeof(string), "Player %s (id: %d) has a  $%d bounty on his head.", giveplayer,giveplayerid,bounty[giveplayerid]);
            SendClientMessage(playerid, COLOR_YELLOW, string);
        } else {
            SendClientMessage(playerid, COLOR_RED, "No such player exists!");
        }

        return 1;
    }

    //------------------- /bounties

    if(strcmp(cmd, "/bounties", true) == 0)
    {
//      new tmp[256];
        new x;

        SendClientMessage(playerid, COLOR_GREEN, "Current Bounties:");
        for(new i=0; i < MAX_PLAYERS; i++) {
            if(IsPlayerConnected(i) && bounty[i] > 0) {
                GetPlayerName(i, giveplayer, sizeof(giveplayer));
                format(string, sizeof(string), "%s%s(%d): $%d", string,giveplayer,i,bounty[i]);

                x++;
                if(x > 3) {
                    SendClientMessage(playerid, COLOR_YELLOW, string);
                    x = 0;
                    format(string, sizeof(string), "");
                } else {
                    format(string, sizeof(string), "%s, ", string);
                }
            }
        }

        if(x <= 3 && x > 0) {
            string[strlen(string)-2] = '.';
            SendClientMessage(playerid, COLOR_YELLOW, string);
        }

        return 1;
    }
    if(strcmp(cmd, "/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;
    }

    //------------------- /ganginfo

    if(strcmp(cmd, "/ganginfo", true) == 0) {
        new tmp[256];
        new gangnum;
        tmp = strtok(cmdtext, idx);

        if(!strlen(tmp) && playerGang[playerid]==0) {
            SendClientMessage(playerid, COLOR_WHITE, "USAGE: /ganginfo [number]");
            return 1;
        } else if (!strlen(tmp))
            gangnum = playerGang[playerid];
        else
            gangnum = strval(tmp);

        if(gangInfo[gangnum][0]==0) {
            SendClientMessage(playerid, COLOR_RED, "No such gang exists!");
            return 1;
        }

        format(string, sizeof(string),"'%s' Gang Members (id: %d)", gangNames[gangnum], gangnum);
        SendClientMessage(playerid, COLOR_GREEN, string);

        for(new i = 0; i < gangInfo[gangnum][1]; i++) {
            GetPlayerName(gangMembers[gangnum][i], giveplayer, sizeof(giveplayer));
            format(string, sizeof(string),"%s (%d)", giveplayer, gangMembers[gangnum][i]);
            SendClientMessage(playerid, COLOR_YELLOW, string);
        }

        return 1;
    }

    //------------------- /gangs

    if(strcmp(cmd, "/gangs", true) == 0)
    {
        new x;

        SendClientMessage(playerid, COLOR_GREEN, "Current Gangs:");
        for(new i=0; i < MAX_GANGS; i++) {
            if(gangInfo[i][0]==1) {
                format(string, sizeof(string), "%s%s(%d) - %d members", string,gangNames[i],i,gangInfo[i][1]);

                x++;
                if(x > 2) {
                    SendClientMessage(playerid, COLOR_YELLOW, string);
                    x = 0;
                    format(string, sizeof(string), "");
                } else {
                    format(string, sizeof(string), "%s, ", string);
                }
            }
        }

        if(x <= 2 && x > 0) {
            string[strlen(string)-2] = '.';
            SendClientMessage(playerid, COLOR_YELLOW, string);
        }

        return 1;
    }

    //------------------- /givecash

    return 0;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
    return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
    return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
    return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
    return 1;
}

public OnPlayerLeaveRaceCheckpoint(playerid)
{
    return 1;
}

public OnRconCommand(cmd[])
{
    return 1;
}

public OnPlayerRequestSpawn(playerid)
{
    return 1;
}

public OnObjectMoved(objectid)
{
    return 1;
}

public OnPlayerObjectMoved(playerid, objectid)
{
    return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
    return 1;
}

public OnVehicleMod(playerid, vehicleid, componentid)
{
    return 1;
}

public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
    return 1;
}

public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
    return 1;
}

public OnPlayerSelectedMenuRow(playerid, row)
{
    return 1;
}

public OnPlayerExitedMenu(playerid)
{
    return 1;
}

public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
    return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    return 1;
}

public OnRconLoginAttempt(ip[], password[], success)
{
    return 1;
}

public OnPlayerUpdate(playerid)
{
    return 1;
}

public OnPlayerStreamIn(playerid, forplayerid)
{
    return 1;
}

public OnPlayerStreamOut(playerid, forplayerid)
{
    return 1;
}

public OnVehicleStreamIn(vehicleid, forplayerid)
{
    return 1;
}

public OnVehicleStreamOut(vehicleid, forplayerid)
{
    return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    return 1;
}

public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
    return 1;
}
pawn Код:
C:\Users\hassane\Desktop\Gang.pwn(112) : warning 219: local variable "gangnum" shadows a variable at a preceding level
C:\Users\hassane\Desktop\Gang.pwn(115) : warning 219: local variable "i" shadows a variable at a preceding level
C:\Users\hassane\Desktop\Gang.pwn(159) : warning 235: public function lacks forward declaration (symbol "isPlayerInArea")
C:\Users\hassane\Desktop\Gang.pwn(170) : warning 235: public function lacks forward declaration (symbol "PayPlayerInArea")
C:\Users\hassane\Desktop\Gang.pwn(218) : error 032: array index out of bounds (variable "gActivePlayers")
C:\Users\hassane\Desktop\Gang.pwn(218) : warning 215: expression has no effect
C:\Users\hassane\Desktop\Gang.pwn(219) : error 032: array index out of bounds (variable "gLastGaveCash")
C:\Users\hassane\Desktop\Gang.pwn(219) : warning 215: expression has no effect
C:\Users\hassane\Desktop\Gang.pwn(219) : error 029: invalid expression, assumed zero
C:\Users\hassane\Desktop\Gang.pwn(226) : error 017: undefined symbol "playrname"
C:\Users\hassane\Desktop\Gang.pwn(226) : error 017: undefined symbol "playrname"
C:\Users\hassane\Desktop\Gang.pwn(226) : error 029: invalid expression, assumed zero
C:\Users\hassane\Desktop\Gang.pwn(226) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


7 Errors.
Reply
#9

pawn Код:
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT

#include <a_samp>
#define dcmd(%1,%2,%3) if ((strcmp(%3, "/%1", true, %2+1) == 0)&&(((%3[%2+1]==0)&&(dcmd_%1(playerid,"")))||((%3[%2+1]==32)&&(dcmd_%1(playerid,%3[%2+2]))))) return 1
#define COLOR_SYSTEM 0xEFEFF7AA

#define COLOR_GREY 0xAFAFAFAA
#define COLOR_GREEN 0x33AA33AA
#define COLOR_RED 0xAA3333AA
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_BLUE 0x0000BBAA
#define COLOR_LIGHTBLUE 0x33CCFFAA
#define COLOR_ORANGE 0xFF9900AA
#define NUMVALUES 4

forward PlayerLeaveGang(playerid);
forward getCheckpointType(playerID);
forward isPlayerInArea(playerID, Float:data[4]);
forward PayPlayerInArea(playerID, Float:x1, Float:y1, Float:x2, Float:y2, cash);

#define MAX_GANGS           32
#define MAX_GANG_MEMBERS    6
#define MAX_GANG_NAME       16
#define MAX_POINTS 11
#define CP_BANK     0
#define CP_PIRATE   1
#define CP_AMMU     2
#define CP_DRAGON   3
#define CP_SEXSHOP  4
#define CP_BAR      5
#define CP_CALIGULA 6
#define CP_ZIP      7
#define CP_BINCO    8
#define CP_TATOO    9
#define CP_BOTIQUE  10

#define P_DRAGON    0
#define P_SEXSHOP   1
#define P_BAR       2
#define P_CALIGULA  3
#define P_ZIP       4
#define P_BINCO     5
#define P_TATOO     6
#define P_BOTIQUE   7
#define P_OFFSET    3
new gangMembers[MAX_GANGS][MAX_GANG_MEMBERS];
new gangNames[MAX_GANGS][MAX_GANG_NAME];
new gangInfo[MAX_GANGS][3]; //0-created,1-members,2-color
new gangBank[MAX_GANGS];
new playerGang[MAX_PLAYERS];
new gangInvite[MAX_PLAYERS];
new gActivePlayers[MAX_PLAYERS];
new gLastGaveCash[MAX_PLAYERS];
new playerCheckpoint[MAX_PLAYERS];
new bank[MAX_PLAYERS];
new playerColors[100] = {


0xFF8C13FF,0xC715FFFF,0x20B2AAFF,0xDC143CFF,0x6495EDFF,0xf0e68cFF,0x778899FF,0xFF1493FF,0xF4A460FF,0xEE82EEFF,0xFFD720FF,
0x8b4513FF,0x4949A0FF,0x148b8bFF,0x14ff7fFF,0x556b2fFF,0x0FD9FAFF,0x10DC29FF,0x534081FF,0x0495CDFF,0xEF6CE8FF,0xBD34DAFF,
0x247C1BFF,0x0C8E5DFF,0x635B03FF,0xCB7ED3FF,0x65ADEBFF,0x5C1ACCFF,0xF2F853FF,0x11F891FF,0x7B39AAFF,0x53EB10FF,0x54137DFF,
0x275222FF,0xF09F5BFF,0x3D0A4FFF,0x22F767FF,0xD63034FF,0x9A6980FF,0xDFB935FF,0x3793FAFF,0x90239DFF,0xE9AB2FFF,0xAF2FF3FF,
0x057F94FF,0xB98519FF,0x388EEAFF,0x028151FF,0xA55043FF,0x0DE018FF,0x93AB1CFF,0x95BAF0FF,0x369976FF,0x18F71FFF,0x4B8987FF,
0x491B9EFF,0x829DC7FF,0xBCE635FF,0xCEA6DFFF,0x20D4ADFF,0x2D74FDFF,0x3C1C0DFF,0x12D6D4FF,0x48C000FF,0x2A51E2FF,0xE3AC12FF,
0xFC42A8FF,0x2FC827FF,0x1A30BFFF,0xB740C2FF,0x42ACF5FF,0x2FD9DEFF,0xFAFB71FF,0x05D1CDFF,0xC471BDFF,0x94436EFF,0xC1F7ECFF,
0xCE79EEFF,0xBD1EF2FF,0x93B7E4FF,0x3214AAFF,0x184D3BFF,0xAE4B99FF,0x7E49D7FF,0x4C436EFF,0xFA24CCFF,0xCE76BEFF,0xA04E0AFF,
0x9F945CFF,0xDCDE3DFF,0x10C9C5FF,0x70524DFF,0x0BE472FF,0x8A2CD7FF,0x6152C2FF,0xCF72A9FF,0xE59338FF,0xEEDC2DFF,0xD8C762FF,
0x3FE65CFF
};
new Float:checkpoints[MAX_POINTS][3] = {
{-22.2549,-55.6575,1003.5469},
{2000.3132,1538.6012,13.5859},
{291.0004,-84.5168,1001.5156},
{1989.0619,1005.5241,994.4688},
{-103.5525,-22.4661,1000.7188},
{501.4927,-75.4323,998.7578},
{2235.5408,1679.0402,1008.3594},
{161.1875,-79.9915,1001.8047},
{207.5640,-97.8188,1005.2578},
{-203.4864,-41.2045,1002.2734},
{418.5547,-80.1667,1001.8047}
};

new checkpointType[MAX_POINTS] = {
    CP_BANK,
    CP_PIRATE,
    CP_AMMU,
    CP_DRAGON,
    CP_SEXSHOP,
    CP_BAR,
    CP_CALIGULA,
    CP_ZIP,
    CP_BINCO,
    CP_TATOO,
    CP_BOTIQUE
};


public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print(" Blank Filterscript by your name here");
    print("--------------------------------------\n");
    return 1;
}

public OnFilterScriptExit()
{
    return 1;
}
public PlayerLeaveGang(playerid) {
    new string[256];
    new playername[MAX_PLAYER_NAME];
    new gangnum = playerGang[playerid];

    if(gangnum > 0) {
        for(new b = 0; b< gangInfo[gangnum][1]; b++) {
            if(gangMembers[gangnum][b]==playerid) {

                //One less gang member
                gangInfo[gangnum][1]--;

                for(new j = b; j < gangInfo[gangnum][1]; j++) {
                    //Shift gang members
                    gangMembers[gangnum][j]=gangMembers[gangnum][j+1];
                }

                //Disband gang if no more members
                if(gangInfo[gangnum][1]<1) {
                    gangInfo[gangnum][0]=0;
                    gangInfo[gangnum][1]=0;
                    gangBank[gangnum]=0;
                }

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

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

                playerGang[playerid]=0;

                SetPlayerColor(playerid,playerColors[playerid]);

                return;
            }
        }
    } else {
        SendClientMessage(playerid, COLOR_RED, "You are not in a gang.");
    }
}

public getCheckpointType(playerID) {
    return checkpointType[playerCheckpoint[playerID]];
}

public isPlayerInArea(playerID, Float:data[4])
{
    new Float:X, Float:Y, Float:Z;

    GetPlayerPos(playerID, X, Y, Z);
    if(X >= data[0] && X <= data[2] && Y >= data[1] && Y <= data[3]) {
        return 1;
    }
    return 0;
}

public PayPlayerInArea(playerID, Float:x1, Float:y1, Float:x2, Float:y2, cash)
{

    if(IsPlayerConnected(playerID))
    {
        new Float:X, Float:Y, Float:Z;

        GetPlayerPos(playerID, X, Y, Z);
        if(X >= x1 && X <= x2 && Y >= y1 && Y <= y2)
        {
            GivePlayerMoney(playerID, cash);
            return 1;
        }
    }
    return 0;
}


main()
{
    print("\n----------------------------------");
    print(" Blank Gamemode by your name here");
    print("----------------------------------\n");
}

public OnGameModeInit()
{
    // Don't use these lines if it's a filterscript
    SetGameModeText("Blank Script");
    AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    return 1;
}

public OnGameModeExit()
{
    return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
    SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
    return 1;
}

public OnPlayerConnect(playerid)
{
   
   
    gLastGaveCash[playerid] = GetTickCount();

    new playername[MAX_PLAYER_NAME];
    new MAX_SAVE;

   
    playerCheckpoint[playerid]=999;
    bank[playerid]=0;
    playerGang[playerid]=0;
    gangInvite[playerid]=0;

    GetPlayerName(playerid, playername, sizeof(playername));
    for(new c = 0; c < MAX_SAVE; c++) {

        if(isStringSame(savedNames[c], playername, MAX_PLAYER_NAME)) {
            GivePlayerMoney(playerid, savedInfo[c][0]);
            bank[playerid] = savedInfo[c][1];
            bounty[playerid] = savedInfo[c][2];

            savedInfo[c][0]=savedInfo[c][1]=savedInfo[c][2]=0;
            savedNames[c][0]=0;

            for(new j = 0; j < MAX_WEAPONS; j++) {
                playerWeapons[playerid][j]=savedWeapons[i][j];
                savedWeapons[i][j]=0;
            }

            SendClientMessage(playerid, COLOR_GREEN, "Your money has been restored.");
            }
        }

    PLAYERLIST_authed[playerid]=false;
    return false;
}

public OnPlayerDisconnect(playerid, reason)
{
    new playername[MAX_PLAYER_NAME];

    gActivePlayers[playerid]--;

    for(new i = 0; i < MAX_PROPERTIES; i++) {
        if(propertyOwner[i]==playerid) {
            propertyOwner[i] = 999;
            GivePlayerMoney(playerid, propertyValues[i]);
        }
    }

    //Save temp info for timeouts/crashes
    GetPlayerName(playerid, playername, sizeof(playername));
    format(savedNames[savePos], MAX_PLAYER_NAME, "%s",playername);

    savedInfo[savePos][0] = GetPlayerMoney(playerid);
    savedInfo[savePos][1] = bank[playerid];
    savedInfo[savePos][2] = bounty[playerid];
    savedInfo[savePos][3] = 0;

    for(new i = 0; i < MAX_WEAPONS; i++)
        savedWeapons[savePos][i]=playerWeapons[playerid][i];
    //
    savePos++;
    if(savePos >= MAX_SAVE)
        savePos = 0;

    PlayerLeaveGang(playerid);
    bounty[playerid] = 0;

    for(new i = 0; i < MAX_WEAPONS;i++) {
        playerWeapons[playerid][i]=0;
    }

  if (PLAYERLIST_authed[playerid]) {
     // Was loggedin, so save the data!
    dUserSetINT(PlayerName(playerid)).("money",GetPlayerMoney(playerid));
  }
  PLAYERLIST_authed[playerid]=false;
  return false;
}
    return 1;
}

public OnPlayerSpawn(playerid)
{
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    new playercash;
    new killedplayer[MAX_PLAYER_NAME];
    new string[256];

    playercash = GetPlayerMoney(playerid);

    if(killerid == INVALID_PLAYER_ID)
    {
        SendDeathMessage(INVALID_PLAYER_ID,playerid,reason);
    }
     else
    {
        SendDeathMessage(killerid,playerid,reason);
        SetPlayerScore(killerid,GetPlayerScore(killerid)+1);
        if(bounty[playerid] > 0 && (playerGang[killerid] == 0 || playerGang[playerid] != playerGang[killerid])) {
            GetPlayerName(playerid, killedplayer, sizeof(killedplayer));
            format(string, sizeof(string), "You earned a bounty of %d for killing %s.", bounty[playerid], killedplayer);
            SendClientMessage(killerid, COLOR_GREEN, string);

            GivePlayerMoney(killerid, bounty[playerid]);
            bounty[playerid] = 0;
        }
        if(playercash > 0)  {
            GivePlayerMoney(killerid, playercash);
        }
    }

    if(playercash > 0)
    {
        ResetPlayerMoney(playerid);
    }
    return 1;
}

public OnVehicleSpawn(vehicleid)
{
    return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
    return 1;
}
public OnPlayerText(playerid, text[])
{
    if(text[0] == '!') {
        if(playerGang[playerid] > 0) {
            new gangChat[256];
            new senderName[MAX_PLAYER_NAME];
            new string[256];

//          for(new i = 1; i < strlen(text)+1; i++)
//              gangChat[i]=text[i];

            strmid(gangChat,text,1,strlen(text));

            GetPlayerName(playerid, senderName, sizeof(senderName));
            format(string, sizeof(string),"%s: %s", senderName, gangChat);

            for(new i = 0; i < gangInfo[playerGang[playerid]][1]; i++) {
                SendClientMessage(gangMembers[playerGang[playerid]][i], COLOR_LIGHTBLUE, string);
            }
        }

        return 0;
    }
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmd, "/gangcommands", true) == 0) {
        SendClientMessage(playerid, COLOR_GREEN,"Gang commands:");
        SendClientMessage(playerid, COLOR_YELLOW,"/gang create [name]");
        SendClientMessage(playerid, COLOR_YELLOW,"/gang join");
        SendClientMessage(playerid, COLOR_YELLOW,"/gang invite [playerID]");
        SendClientMessage(playerid, COLOR_YELLOW,"/gang quit");
        SendClientMessage(playerid, COLOR_YELLOW,"/ganginfo [number] (no number given shows your gang's info)");
        SendClientMessage(playerid, COLOR_YELLOW,"/gbank [money] /gwithdraw [money] /gbalance");
        SendClientMessage(playerid, COLOR_YELLOW,"! (prefix text for gang-chat)");
        return 1;
    }
    if(strcmp(cmd, "/bank", true) == 0 || strcmp(cmd, "/gbank", true) == 0) {
        new gang;
        if(strcmp(cmd, "/gbank", true) == 0)
            gang = 1;

            return 1;
        }

        if(gang && playerGang[playerid]==0) {
            SendClientMessage(playerid, COLOR_RED, "You are not in a gang!");
            return 1;
        }

        new tmp[256];
        tmp = strtok(cmdtext, idx);

        if(!strlen(tmp)) {
            SendClientMessage(playerid, COLOR_WHITE, "USAGE: /(g)bank [amount]");
            return 1;
        }
        moneys = strval(tmp);

        if(moneys < 1) {
            SendClientMessage(playerid, COLOR_YELLOW, "Incorrect Amount.");
            return 1;
        }

        if(GetPlayerMoney(playerid) < moneys) {
            moneys = GetPlayerMoney(playerid);
        }

        GivePlayerMoney(playerid, 0-moneys);

        if(gang)
            gangBank[playerGang[playerid]]+=moneys;
        else
            bank[playerid]+=moneys;

        if(gang)
            format(string, sizeof(string), "You have deposited $%d, your gang's balance is $%d.", moneys, gangBank[playerGang[playerid]]);
        else
            format(string, sizeof(string), "You have deposited $%d, your current balance is $%d.", moneys, bank[playerid]);

        SendClientMessage(playerid, COLOR_YELLOW, string);

        return 1;
    }
        if(strcmp(cmd, "/withdraw", true) == 0 || strcmp(cmd, "/gwithdraw", true) == 0) {
        new gang;

            return 1;
        }

        if(strcmp(cmd, "/gwithdraw", true) == 0)
            gang = 1;

        if(gang && playerGang[playerid]==0) {
            SendClientMessage(playerid, COLOR_RED, "You are not in a gang!");
            return 1;
        }

        new tmp[256];
        tmp = strtok(cmdtext, idx);

        if(!strlen(tmp)) {
            SendClientMessage(playerid, COLOR_WHITE, "USAGE: /(g)withdraw [amount]");
            return 1;
        }
        moneys = strval(tmp);

        if(moneys < 1) {
            SendClientMessage(playerid, COLOR_YELLOW, "Hey what are you trying to pull here.");
            return 1;
        }

        if(gang) {
            if(moneys > gangBank[playerGang[playerid]])
                moneys = gangBank[playerGang[playerid]];
        } else {
            if(moneys > bank[playerid])
                moneys = bank[playerid];
        }

        GivePlayerMoney(playerid, moneys);
        if(gang)
            gangBank[playerGang[playerid]] -= moneys;
        else
            bank[playerid] -= moneys;

        if(gang)
            format(string, sizeof(string), "You have withdrawn $%d, your gang's balance is $%d.", moneys, gangBank[playerGang[playerid]]);
        else
            format(string, sizeof(string), "You have withdrawn $%d, your current balance is $%d.", moneys, bank[playerid]);
        SendClientMessage(playerid, COLOR_YELLOW, string);

        return 1;
    }

    //------------------- /balance

    if(strcmp(cmd, "/balance", true) == 0 || strcmp(cmd, "/gbalance", true) == 0) {
        new gang;
        if(strcmp(cmd, "/gbalance", true) == 0)
            gang = 1;

            return 1;
        }

        if(gang && playerGang[playerid]==0) {
            SendClientMessage(playerid, COLOR_RED, "You are not in a gang!");
            return 1;
        }

        if(gang)
            format(string, sizeof(string), "Your gang has $%d in the bank.", gangBank[playerGang[playerid]]);
        else
            format(string, sizeof(string), "You have $%d in the bank.", bank[playerid]);
        SendClientMessage(playerid, COLOR_YELLOW, string);

        return 1;
    }
    if(strcmp(cmd, "/hitman", true) == 0) {
        new tmp[256];
        tmp = strtok(cmdtext, idx);

        if(!strlen(tmp)) {
            SendClientMessage(playerid, COLOR_WHITE, "USAGE: /hitman [playerid] [amount]");
            return 1;
        }
        giveplayerid = strval(tmp);

        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp)) {
            SendClientMessage(playerid, COLOR_WHITE, "USAGE: /hitman [playerid] [amount]");
            return 1;
        }
        moneys = strval(tmp);

        if(moneys > GetPlayerMoney(playerid)) {
            SendClientMessage(playerid, COLOR_RED, "You don't have enough money!");
            return 1;
        }
        if(moneys < 1) {
            SendClientMessage(playerid, COLOR_YELLOW, "Hey what are you trying to pull here.");
            return 1;
        }
        if(IsPlayerConnected(giveplayerid)==0) {
            SendClientMessage(playerid, COLOR_RED, "No such player exists.");
            return 1;
        }

        bounty[giveplayerid]+=moneys;
        GivePlayerMoney(playerid, 0-moneys);

        GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
        GetPlayerName(playerid, sendername, sizeof(sendername));

        format(string, sizeof(string), "You have put a $%d bounty on the head of %s (id: %d).", moneys, giveplayer,giveplayerid);
        SendClientMessage(playerid, COLOR_YELLOW, string);

        format(string, sizeof(string), "%s has had a $%d bounty put on his head from %s (total: $%d).", giveplayer, moneys, sendername, bounty[giveplayerid]);
        SendClientMessageToAll(COLOR_ORANGE, string);

        format(string, sizeof(string), "You have had a $%d bounty put on you from %s (id: %d).", moneys, sendername, playerid);
        SendClientMessage(giveplayerid, COLOR_RED, string);

        return 1;
    }
        if(strcmp(cmd, "/bounty", true) == 0) {
        new tmp[256];
        tmp = strtok(cmdtext, idx);

        if(!strlen(tmp)) {
            SendClientMessage(playerid, COLOR_WHITE, "USAGE: /bounty [playerid]");
            return 1;
        }
        giveplayerid = strval(tmp);

        if(IsPlayerConnected(giveplayerid)) {
            GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
            format(string, sizeof(string), "Player %s (id: %d) has a  $%d bounty on his head.", giveplayer,giveplayerid,bounty[giveplayerid]);
            SendClientMessage(playerid, COLOR_YELLOW, string);
        } else {
            SendClientMessage(playerid, COLOR_RED, "No such player exists!");
        }

        return 1;
    }

    //------------------- /bounties

    if(strcmp(cmd, "/bounties", true) == 0)
    {
//      new tmp[256];
        new x;

        SendClientMessage(playerid, COLOR_GREEN, "Current Bounties:");
        for(new i=0; i < MAX_PLAYERS; i++) {
            if(IsPlayerConnected(i) && bounty[i] > 0) {
                GetPlayerName(i, giveplayer, sizeof(giveplayer));
                format(string, sizeof(string), "%s%s(%d): $%d", string,giveplayer,i,bounty[i]);

                x++;
                if(x > 3) {
                    SendClientMessage(playerid, COLOR_YELLOW, string);
                    x = 0;
                    format(string, sizeof(string), "");
                } else {
                    format(string, sizeof(string), "%s, ", string);
                }
            }
        }

        if(x <= 3 && x > 0) {
            string[strlen(string)-2] = '.';
            SendClientMessage(playerid, COLOR_YELLOW, string);
        }

        return 1;
    }
    if(strcmp(cmd, "/gang", true) == 0) {
        new tmp[256];
        new gangcmd;
        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;
    }

    //------------------- /ganginfo

    if(strcmp(cmd, "/ganginfo", true) == 0) {
        new tmp[256];
       
        tmp = strtok(cmdtext, idx);

        if(!strlen(tmp) && playerGang[playerid]==0) {
            SendClientMessage(playerid, COLOR_WHITE, "USAGE: /ganginfo [number]");
            return 1;
        } else if (!strlen(tmp))
            gangnum = playerGang[playerid];
        else
            gangnum = strval(tmp);

        if(gangInfo[gangnum][0]==0) {
            SendClientMessage(playerid, COLOR_RED, "No such gang exists!");
            return 1;
        }

        format(string, sizeof(string),"'%s' Gang Members (id: %d)", gangNames[gangnum], gangnum);
        SendClientMessage(playerid, COLOR_GREEN, string);

        for(new i = 0; i < gangInfo[gangnum][1]; i++) {
            GetPlayerName(gangMembers[gangnum][i], giveplayer, sizeof(giveplayer));
            format(string, sizeof(string),"%s (%d)", giveplayer, gangMembers[gangnum][i]);
            SendClientMessage(playerid, COLOR_YELLOW, string);
        }

        return 1;
    }

    //------------------- /gangs

    if(strcmp(cmd, "/gangs", true) == 0)
    {
        new x;

        SendClientMessage(playerid, COLOR_GREEN, "Current Gangs:");
        for(new i=0; i < MAX_GANGS; i++) {
            if(gangInfo[i][0]==1) {
                format(string, sizeof(string), "%s%s(%d) - %d members", string,gangNames[i],i,gangInfo[i][1]);

                x++;
                if(x > 2) {
                    SendClientMessage(playerid, COLOR_YELLOW, string);
                    x = 0;
                    format(string, sizeof(string), "");
                } else {
                    format(string, sizeof(string), "%s, ", string);
                }
            }
        }

        if(x <= 2 && x > 0) {
            string[strlen(string)-2] = '.';
            SendClientMessage(playerid, COLOR_YELLOW, string);
        }

        return 1;
    }

    //------------------- /givecash

    return 0;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
    return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
    return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
    return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
    return 1;
}

public OnPlayerLeaveRaceCheckpoint(playerid)
{
    return 1;
}

public OnRconCommand(cmd[])
{
    return 1;
}

public OnPlayerRequestSpawn(playerid)
{
    return 1;
}

public OnObjectMoved(objectid)
{
    return 1;
}

public OnPlayerObjectMoved(playerid, objectid)
{
    return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
    return 1;
}

public OnVehicleMod(playerid, vehicleid, componentid)
{
    return 1;
}

public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
    return 1;
}

public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
    return 1;
}

public OnPlayerSelectedMenuRow(playerid, row)
{
    return 1;
}

public OnPlayerExitedMenu(playerid)
{
    return 1;
}

public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
    return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    return 1;
}

public OnRconLoginAttempt(ip[], password[], success)
{
    return 1;
}

public OnPlayerUpdate(playerid)
{
    return 1;
}

public OnPlayerStreamIn(playerid, forplayerid)
{
    return 1;
}

public OnPlayerStreamOut(playerid, forplayerid)
{
    return 1;
}

public OnVehicleStreamIn(vehicleid, forplayerid)
{
    return 1;
}

public OnVehicleStreamOut(vehicleid, forplayerid)
{
    return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    return 1;
}

public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
    return 1;
}

Just Make a callback for isStringSame
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)