you are not a cop error & suspect killed
#1

im trying to use the command /ticket and it seems it aint working and i dont understand whats wrong,heres the code



pawn Код:
if(strcmp(cmd, "/ticket", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(gTeam[playerid] != 2)
            {
                SCM(playerid, COLOR_GREY, "   You are not a Cop!");
                return 1;
            }
            if(OnDuty[playerid] != 1 && PlayerInfo[playerid][pMember] == 1)
            {
                SCM(playerid, COLOR_GREY, "   You are not on Duty!");
                return 1;
            }
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SCM(playerid, COLOR_GRAD2, "USAGE: /ticket [playerid/PartOfName] [price] [reason]");
                return 1;
            }
            giveplayerid = ReturnUser(tmp);
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SCM(playerid, COLOR_GRAD2, "USAGE: /ticket [playerid/PartOfName] [price] [reason]");
                return 1;
            }
            moneys = strval(tmp);
            if(moneys < 1 || moneys > 99999) { SCM(playerid, COLOR_GREY, "   Ticket Money can't be below 1 or higher then 99999 !"); return 1; }
            if(IsPlayerConnected(giveplayerid))
            {
                if(giveplayerid != INVALID_PLAYER_ID)
                {
                    if (ProxDetectorS(8.0, playerid, giveplayerid))
                    {
                        GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                        new length = strlen(cmdtext);
                        while ((idx < length) && (cmdtext[idx] <= ' '))
                        {
                            idx++;
                        }
                        new offset = idx;
                        new result[64];
                        while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
                        {
                            result[idx - offset] = cmdtext[idx];
                            idx++;
                        }
                        result[idx - offset] = EOS;
                        if(!strlen(result))
                        {
                            SCM(playerid, COLOR_GRAD2, "USAGE: /ticket [playerid/PartOfName] [price] [reason]");
                            return 1;
                        }
                        format(string, sizeof(string), "* You gave %s a Ticket costing $%d, reason: %s", giveplayer, moneys, (result));
                        SCM(playerid, COLOR_LIGHTBLUE, string);
                        format(string, sizeof(string), "* Officer %s has given you a Ticket costing $%d, reason: %s", sendername, moneys, (result));
                        SCM(giveplayerid, COLOR_LIGHTBLUE, string);
                        SCM(giveplayerid, COLOR_LIGHTBLUE, "* Type /accept ticket, to accept it.");
                        TicketOffer[giveplayerid] = playerid;
                        TicketMoney[giveplayerid] = moneys;
                        return 1;
                    }
                    else
                    {
                        SCM(playerid, COLOR_GREY, "   That player is not near you !");
                        return 1;
                    }
                }
            }
            else
            {
                SCM(playerid, COLOR_GREY, "   That player is Offline !");
                return 1;
            }
        }
        return 1;
    }

it says "you are not a cop" even if im on or off duty ,any idea?


edit : the gov command says the same thing,but i think ill be able to fix it if you can help me with the one above

i'll also add 1 more thing here so i dont open another topic,when the suspect is killed,as a cop,i dont get the money and the suspect doesnt go to jail

pawn Код:
if(newstate == PLAYER_STATE_WASTED)
    {
        if(WantedLevel[playerid] >= 1)
        {
            new price = WantedLevel[playerid] * 500;
            new count;
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                if(IsPlayerConnected(i))
                {
                    if(gTeam[i] == 2 && CrimInRange(30.0, playerid,i))
                    {
                        count = 1;
                        format(string, sizeof(string), "~w~Running Suspect~r~Killed~n~Bonus~g~$%d", price);
                        GameTextForPlayer(i, string, 5000, 1);
                        ConsumingMoney[i] = 1;
                        GivePlayerMoney(i, price / 2);
                        PlayerPlaySound(i, 1058, 0.0, 0.0, 0.0);
                    }
                }
            }
            if(count == 1)
            {
                PlayerInfo[playerid][pMats] = 0;
                GivePlayerMoney(playerid, - price);
                PlayerInfo[playerid][pWantedDeaths] += 1;
                PlayerInfo[playerid][pJailed] = 1;
                PlayerInfo[playerid][pJailTime] = (WantedLevel[playerid])*(300);
                SetPlayerWantedLevel(playerid, 0);
                format(string, sizeof(string), "* You are in Jail for %d Seconds and lose $%d because of running away and getting shot by the Officer.", PlayerInfo[playerid][pJailTime], price);
                SCM(playerid, COLOR_LIGHTRED, string);
                WantedPoints[playerid] = 0;
                WantedLevel[playerid] = 0;
            }
        }
    }

thx in advance
Reply
#2

Try to place the wasted part @ OnPlayerDeath
Reply
#3

what should i change this
pawn Код:
if(newstate == PLAYER_STATE_WASTED)
to ?

or i just remove that part ?
Reply
#4

Remove it.
Reply
#5

~ deleted ~
Reply
#6

Quote:
Originally Posted by rekatluos
Посмотреть сообщение
im trying to use the command /ticket and it seems it aint working and i dont understand whats wrong,heres the code



pawn Код:
if(strcmp(cmd, "/ticket", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(gTeam[playerid] != 2)
            {
                SCM(playerid, COLOR_GREY, "   You are not a Cop!");
                return 1;
            }
            if(OnDuty[playerid] != 1 && PlayerInfo[playerid][pMember] == 1)
            {
                SCM(playerid, COLOR_GREY, "   You are not on Duty!");
                return 1;
            }
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SCM(playerid, COLOR_GRAD2, "USAGE: /ticket [playerid/PartOfName] [price] [reason]");
                return 1;
            }
            giveplayerid = ReturnUser(tmp);
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SCM(playerid, COLOR_GRAD2, "USAGE: /ticket [playerid/PartOfName] [price] [reason]");
                return 1;
            }
            moneys = strval(tmp);
            if(moneys < 1 || moneys > 99999) { SCM(playerid, COLOR_GREY, "   Ticket Money can't be below 1 or higher then 99999 !"); return 1; }
            if(IsPlayerConnected(giveplayerid))
            {
                if(giveplayerid != INVALID_PLAYER_ID)
                {
                    if (ProxDetectorS(8.0, playerid, giveplayerid))
                    {
                        GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                        new length = strlen(cmdtext);
                        while ((idx < length) && (cmdtext[idx] <= ' '))
                        {
                            idx++;
                        }
                        new offset = idx;
                        new result[64];
                        while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
                        {
                            result[idx - offset] = cmdtext[idx];
                            idx++;
                        }
                        result[idx - offset] = EOS;
                        if(!strlen(result))
                        {
                            SCM(playerid, COLOR_GRAD2, "USAGE: /ticket [playerid/PartOfName] [price] [reason]");
                            return 1;
                        }
                        format(string, sizeof(string), "* You gave %s a Ticket costing $%d, reason: %s", giveplayer, moneys, (result));
                        SCM(playerid, COLOR_LIGHTBLUE, string);
                        format(string, sizeof(string), "* Officer %s has given you a Ticket costing $%d, reason: %s", sendername, moneys, (result));
                        SCM(giveplayerid, COLOR_LIGHTBLUE, string);
                        SCM(giveplayerid, COLOR_LIGHTBLUE, "* Type /accept ticket, to accept it.");
                        TicketOffer[giveplayerid] = playerid;
                        TicketMoney[giveplayerid] = moneys;
                        return 1;
                    }
                    else
                    {
                        SCM(playerid, COLOR_GREY, "   That player is not near you !");
                        return 1;
                    }
                }
            }
            else
            {
                SCM(playerid, COLOR_GREY, "   That player is Offline !");
                return 1;
            }
        }
        return 1;
    }

it says "you are not a cop" even if im on or off duty ,any idea?


edit : the gov command says the same thing,but i think ill be able to fix it if you can help me with the one above

i'll also add 1 more thing here so i dont open another topic,when the suspect is killed,as a cop,i dont get the money and the suspect doesnt go to jail

pawn Код:
if(newstate == PLAYER_STATE_WASTED)
    {
        if(WantedLevel[playerid] >= 1)
        {
            new price = WantedLevel[playerid] * 500;
            new count;
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                if(IsPlayerConnected(i))
                {
                    if(gTeam[i] == 2 && CrimInRange(30.0, playerid,i))
                    {
                        count = 1;
                        format(string, sizeof(string), "~w~Running Suspect~r~Killed~n~Bonus~g~$%d", price);
                        GameTextForPlayer(i, string, 5000, 1);
                        ConsumingMoney[i] = 1;
                        GivePlayerMoney(i, price / 2);
                        PlayerPlaySound(i, 1058, 0.0, 0.0, 0.0);
                    }
                }
            }
            if(count == 1)
            {
                PlayerInfo[playerid][pMats] = 0;
                GivePlayerMoney(playerid, - price);
                PlayerInfo[playerid][pWantedDeaths] += 1;
                PlayerInfo[playerid][pJailed] = 1;
                PlayerInfo[playerid][pJailTime] = (WantedLevel[playerid])*(300);
                SetPlayerWantedLevel(playerid, 0);
                format(string, sizeof(string), "* You are in Jail for %d Seconds and lose $%d because of running away and getting shot by the Officer.", PlayerInfo[playerid][pJailTime], price);
                SCM(playerid, COLOR_LIGHTRED, string);
                WantedPoints[playerid] = 0;
                WantedLevel[playerid] = 0;
            }
        }
    }

thx in advance
Sorry for doublepost, it's to bump the thread.

Are you sure you set 'gTeam' on /invite or /makeelader or whatever your command is?
And you didn't SetPlayerPos in the jail area.

Quote:
pawn Код:
SetPlayerWantedLevel(playerid, 0);                
    format(string, sizeof(string), "* You are in Jail for %d Seconds and lose $%d because of running away and getting shot by the Officer.", PlayerInfo[playerid][pJailTime], price);                
    SCM(playerid, COLOR_LIGHTRED, string);                
    WantedPoints[playerid] = 0;                
    WantedLevel[playerid] = 0;            
}
Try adding
pawn Код:
SetPlayerPos(playerid, 215.0438, 109.7535, 999.0156);
SetPlayerInterior(playerid, 10);
to it.
Reply
#7

this is the invite cmd
pawn Код:
if(strcmp(cmd, "/invite", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SCM(playerid, COLOR_GRAD2, "USAGE: /invite [playerid/PartOfName]");
                return 1;
            }
            new para1;
            new ftext[20];
            para1 = ReturnUser(tmp);
            if (PlayerInfo[playerid][pLeader] >= 1)
            {
                if(IsPlayerConnected(para1))
                {
                    if(para1 != INVALID_PLAYER_ID)
                    {
                        if (gTeam[para1]==TEAM_GREEN && PlayerInfo[para1][pMember] == 0 && PlayerInfo[para1][pFMember] == 255)
                        {
                            if(PlayerInfo[para1][pJob] > 0)
                            {
                                SCM(playerid, COLOR_GREY, "   Can't invite him, player has a Job !");
                                return 1;
                            }
                            if(PlayerInfo[playerid][pLeader] == 1) { PlayerInfo[para1][pTeam] = 2; gTeam[para1] = 2; ftext = "Police Force"; ChosenSkin[para1] = 280; SetPlayerSkin(para1, 280); }
                            else if(PlayerInfo[playerid][pLeader] == 2) { PlayerInfo[para1][pTeam] = 2; gTeam[para1] = 2; ftext = "FBI/ATF"; ChosenSkin[para1] = 286; SetPlayerSkin(para1, 286); }
                            else if(PlayerInfo[playerid][pLeader] == 3) { PlayerInfo[para1][pTeam] = 2; gTeam[para1] = 2; ftext = "National Guard"; ChosenSkin[para1] = 287; SetPlayerSkin(para1, 287); }
                            else if(PlayerInfo[playerid][pLeader] == 4) { PlayerInfo[para1][pTeam] = 1; gTeam[para1] = 1; ftext = "Firemen/Ambulance"; ChosenSkin[para1] = 70; SetPlayerSkin(para1, 70); }
                            else if(PlayerInfo[playerid][pLeader] == 5) { PlayerInfo[para1][pTeam] = 5; gTeam[para1] = 5; ftext = "Corleone"; ChosenSkin[para1] = 258; SetPlayerSkin(para1, 120); }
                            else if(PlayerInfo[playerid][pLeader] == 6) { PlayerInfo[para1][pTeam] = 5; gTeam[para1] = 5; ftext = "Barzini "; ChosenSkin[para1] = 120; SetPlayerSkin(para1, 258); }
                            else if(PlayerInfo[playerid][pLeader] == 7) { return 1; }
                            else if(PlayerInfo[playerid][pLeader] == 8) { PlayerInfo[para1][pTeam] = 10; gTeam[para1] = 12; ftext = "Hitman Agency"; ChosenSkin[para1] = 127; SetPlayerSkin(para1, 127); }
                            else if(PlayerInfo[playerid][pLeader] == 9) { PlayerInfo[para1][pTeam] = 12; gTeam[para1] = 12; ftext = "CNN Studio"; ChosenSkin[para1] = 148; SetPlayerSkin(para1, 148); }
                            else if(PlayerInfo[playerid][pLeader] == 10) { PlayerInfo[para1][pTeam] = 12; gTeam[para1] = 12; ftext = "Taxi Cab Company"; ChosenSkin[para1] = 255; SetPlayerSkin(para1, 255); }
                            else if(PlayerInfo[playerid][pLeader] == 11) { PlayerInfo[para1][pTeam] = 12; gTeam[para1] = 12; ftext = "School Instructors"; ChosenSkin[para1] = 59; SetPlayerSkin(para1, 59); }
                            else if(PlayerInfo[playerid][pLeader] == 12) { PlayerInfo[para1][pTeam] = 12; gTeam[para1] = 12; ftext = "The Nang Boys"; ChosenSkin[para1] = 184; SetPlayerSkin(para1, 184); }
                            else if(PlayerInfo[playerid][pLeader] == 13) { PlayerInfo[para1][pTeam] = 12; gTeam[para1] = 12; ftext = "Underground Street"; ChosenSkin[para1] = 24; SetPlayerSkin(para1, 24); }
                            else if(PlayerInfo[playerid][pLeader] == 14) { PlayerInfo[para1][pTeam] = 12; gTeam[para1] = 12; ftext = "Ballas"; ChosenSkin[para1] = 104; SetPlayerSkin(para1, 104); }
                            else if(PlayerInfo[playerid][pLeader] == 15) { PlayerInfo[para1][pTeam] = 12; gTeam[para1] = 12; ftext = "Grove"; ChosenSkin[para1] = 271; SetPlayerSkin(para1, 271); }
                            else if(PlayerInfo[playerid][pLeader] == 16) { PlayerInfo[para1][pTeam] = 12; gTeam[para1] = 12; ftext = "Los Santos Vagos"; ChosenSkin[para1] = 110; SetPlayerSkin(para1, 110); }
                            else if(PlayerInfo[playerid][pLeader] == 17) { PlayerInfo[para1][pTeam] = 12; gTeam[para1] = 12; ftext = "Tow Car Company"; ChosenSkin[para1] = 50; SetPlayerSkin(para1, 50); }
                            else { return 1; }
                            GetPlayerName(para1, giveplayer, sizeof(giveplayer));
                            GetPlayerName(playerid, sendername, sizeof(sendername));
                            PlayerInfo[para1][pMember] = PlayerInfo[playerid][pLeader];
                            PlayerInfo[para1][pRank] = 1;
                            PlayerInfo[para1][pFwarn] = 0;
                            printf("AdmCmd: %s has invited %s to join %s.", sendername, giveplayer, ftext);
                            format(string, sizeof(string), "   You have Joined the %s, you were invited by Leader %s", ftext, sendername);
                            SCM(para1, COLOR_LIGHTBLUE, string);
                            format(string, sizeof(string), "   You have Invited %s to join the %s.", giveplayer,ftext);
                            SCM(playerid, COLOR_LIGHTBLUE, string);
                            SetPlayerInterior(para1,0);
                            new rand = random(sizeof(gInviteSpawns));
                            SetPlayerPos(para1, gInviteSpawns[rand][0], gInviteSpawns[rand][1], gInviteSpawns[rand][2]); // Warp the player
                            SetPlayerFacingAngle(para1, gInviteSpawns[rand][3]);
                            SetPlayerCameraPos(para1,gInviteSpawns[rand][0] + 3, gInviteSpawns[rand][1], gInviteSpawns[rand][2]);
                            SetPlayerCameraLookAt(para1,gInviteSpawns[rand][0], gInviteSpawns[rand][1], gInviteSpawns[rand][2]);
                            TogglePlayerControllable(para1, 0);
                            SelectChar[para1] = 255;
                            SelectCharID[para1] = PlayerInfo[para1][pMember];
                            SelectCharPlace[para1] = 1;
                            PlayerInfo[para1][pModel] = ChosenSkin[para1];
                            PlayerInfo[para1][pChar] = ChosenSkin[para1];
                            SCM(para1, COLOR_LIGHTRED, "* Use 'next' to Select the char you want to use.");
                            SCM(para1, COLOR_LIGHTRED, "* If you've found the Char you want to use, type 'done'.");
                        }
                        else
                        {
                            SCM(playerid, COLOR_GREY, "  That player is currently Wanted / a Different Team / or already a Family Member.");
                            return 1;
                        }
                    }
                }//not connected
            }
        }
        return 1;
    }
and this is the makeleader command

pawn Код:
if(strcmp(cmd, "/makeleader", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SCM(playerid, COLOR_GRAD2, "USAGE: /makeleader [playerid/PartOfName] [Number(1-16)]");
                SCM(playerid, COLOR_WHITE, "ID = 1 = Police Force || ID = 2 = FBI || ID = 3 = National Guard || ID = 4 = Ambulance ||");
                SCM(playerid, COLOR_WHITE, "ID = 5 = Corleone || ID = 6 = Barzini  || ID = 7 Presedinte || ID = 8 = Hitman ||");
                SCM(playerid, COLOR_WHITE, "ID = 9 = News Reporter || ID = 10 = Taxi || ID = 11 = School Instructor || ID = 12 = The Nang Boys ||");
                SCM(playerid, COLOR_WHITE, "ID = 13 = Underground Street Tunning || ID = 14 = Ballas || ID = 15 Grove || ID = 16 Los Santos Vagos");
                SCM(playerid, COLOR_WHITE, "ID = 17 = Tow Car Company");
                return 1;
            }
            new para1;
            new level;
            para1 = ReturnUser(tmp);
            tmp = strtok(cmdtext, idx);
            level = strval(tmp);
            if(level > 17 || level < 0) { SCM(playerid, COLOR_GREY, "   Dont go below number 0, or above number 17!"); return 1; }
            if (PlayerInfo[playerid][pAdmin] >= 1337)
            {
                if(IsPlayerConnected(para1))
                {
                    if(para1 != INVALID_PLAYER_ID)
                    {
                        if(PlayerInfo[para1][pMember] > 0 || PlayerInfo[para1][pFMember] < 255)
                        {
                            SCM(playerid, COLOR_GREY, "   That player is in a Faction / Family !");
                            return 1;
                        }
                        GetPlayerName(para1, giveplayer, sizeof(giveplayer));
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                        PlayerInfo[para1][pLeader] = level;
                        PlayerInfo[para1][pRank] = 6;
                        SetPlayerHealth(para1, 0.0);
                        format(string, sizeof(string), "   You have been promoted to Leader to your requested Faction by Admin %s", sendername);
                        SCM(para1, COLOR_LIGHTBLUE, string);
                        format(string, sizeof(string), "   You have given %s control to run Faction Number %d.", giveplayer,level);
                        SCM(playerid, COLOR_LIGHTBLUE, string);
                        if(level == 0) { PlayerInfo[para1][pChar] = 0; }
                        else if(level == 1) { PlayerInfo[para1][pChar] = 71; } //Police Force
                        else if(level == 2) { PlayerInfo[para1][pChar] = 285; } //FBI/ATF
                        else if(level == 3) { PlayerInfo[para1][pChar] = 287; } //National Guard
                        else if(level == 4) { PlayerInfo[para1][pChar] = 228; } //Fire/Ambulance
                        else if(level == 5) { PlayerInfo[para1][pChar] = 113; } //Corleone
                        else if(level == 6) { PlayerInfo[para1][pChar] = 270; } //Barzini
                        else if(level == 7) { PlayerInfo[para1][pChar] = 186; } //Mayor
                        else if(level == 8) { PlayerInfo[para1][pChar] = 294; } //Hitmans
                        else if(level == 9) { PlayerInfo[para1][pChar] = 227; } //News Reporters
                        else if(level == 10) { PlayerInfo[para1][pChar] = 61; } //Taxi Cab Company
                        else if(level == 11) { PlayerInfo[para1][pChar] = 171; } //Driving/Flying School
                        else if(level == 12) { PlayerInfo[para1][pChar] = 184; } //The Nang Boys
                        else if(level == 13) { PlayerInfo[para1][pChar] = 24; } //Underground Street Tunning
                        else if(level == 14) { PlayerInfo[para1][pChar] = 104; } //Ballas
                        else if(level == 15) { PlayerInfo[para1][pChar] = 271; } //Grove
                        else if(level == 16) { PlayerInfo[para1][pChar] = 110; } //Los Santos Vagos
                        else if(level == 17) { PlayerInfo[para1][pChar] = 50; } //Tow Car Comapny
                        gTeam[para1] = 17;
                        PlayerInfo[para1][pTeam] = 17;
                        SetPlayerSkin(para1, PlayerInfo[para1][pChar]);
                        GetPlayerName(playerid, numewarning, sizeof(numewarning));
                        format(string, sizeof(string), "[AdmWarning]: %s ia dat leader[%d] lui %s.",numewarning,level,giveplayer);
                        ABroadCast(COLOR_LIGHTRED,string, 5);
                    }
                }//not connected
            }
            else
            {
                SCM(playerid, COLOR_GRAD1, "   you are not authorized to use that command!");
            }
        }
        return 1;
    }

btw i just tested ingame with /setteam 2 (1 being civ,2 being cop) and everything works fine ,ticket gov and suspect getting killed i get the money and he goes to jail .

it looks like in the makeleader command there aint anything about setting the team,should i add it like the invite command ?


thx for your help
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)