Arrest help
#1

Well when im making /arrest
it says "You cannot arrest when you are dead""


PHP код:
COMMAND:arrest(playeridparams[])
{
    new 
vehicleid GetPlayerVehicleID(playerid);
    if (
PlayerInfo[playerid][pSpawn] == && CarInfo[vehicleid][cType] == VEHICLE_TYPE_LAW_ENFOREMENT)
    {
        if (
PlayerInfo[playerid][pTeam] == TEAM_LAW || PlayerInfo[playerid][pVigilante] == 1)
        {
            new 
idx,giveplayerid,string[256],tmp[256];
            
tmp strtok(paramsidx);
            if (!
strlen(tmp))
            {
                new 
WantedSuspects;
                for (new 
0GetMaxPlayers(); i++)
                {
                    if (
IsPlayerConnected(i) && != playerid && !IsPlayerNPC(i) && PlayerInfo[i][pSpawn] == && PlayerInfo[i][pWantedLevel] > && GetDistanceBetweenPlayers(playerid,i) < 10)
                    {
                        
WantedSuspects ++;
                        if (
WantedSuspects 0)giveplayerid i; break;
                    }
                }
                if (
WantedSuspects == 0)
                    return 
SendClientMessage(playeridCOLOR_ERROR"No Suspects In Range.");
            }else{
                if (!
isNumeric(tmp))
                {
                    
giveplayerid ReturnUser(playeridtmp);
                    if (
giveplayerid == INVALID_PLAYER_ID)
                    {
                        return 
1;
                    }
                }
                else
                {
                    
giveplayerid strval(tmp);
                    if (!
IsPlayerConnected(giveplayerid))
                    {
                        
format(stringsizeof(string), "%d Is Not A Valid ID."giveplayerid);
                        
SendClientMessage(playeridCOLOR_ERRORstring);
                        return 
1;
                    }
                }
            }
            if (
giveplayerid == playerid)
            {
                
SendClientMessage(playeridCOLOR_ERROR"You Cannot Arrest Yourself.");
                return 
1;
            }
            if (
GetDistanceBetweenPlayers(playerid,giveplayerid) > 5)
            {
                
format(stringsizeof(string), "%s Is Not Close Enough To Arrest.",PlayerInfo[giveplayerid][pName]);
                
SendClientMessage(playerid,COLOR_ERRORstring);
                return 
1;
            }
            if (
GetPlayerVirtualWorld(playerid) != GetPlayerVirtualWorld(giveplayerid))
            {
                
SendClientMessage(playeridCOLOR_ERROR"No Suspects In Range.");
                return 
1;
            }
            if (
PlayerInfo[giveplayerid][pTeam] == TEAM_LAW || PlayerInfo[giveplayerid][pVigilante] == 1)
            {
                
format(stringsizeof(string), "%s (%d) Is A Law Enforcement Agent And Cannot Be Arrested.",PlayerInfo[giveplayerid][pName],giveplayerid);
                
SendClientMessage(playerid,COLOR_ERRORstring);
                return 
1;
            }
            if (
PlayerInfo[giveplayerid][pWantedLevel] < 6)
            {
                
format(stringsizeof(string), "%s (%d) Does Not Have A Warrant Issued.",PlayerInfo[giveplayerid][pName],giveplayerid);
                
SendClientMessage(playerid,COLOR_ERRORstring);
                return 
1;
            }
            if (
GetPlayerState(playerid) == PLAYER_STATE_ONFOOT && GetPlayerState(giveplayerid) != PLAYER_STATE_ONFOOT)
            {
                
SendClientMessage(playeridCOLOR_ERROR"No Suspects In Range.");
                return 
1;
            }
            if (
PlayerInfo[giveplayerid][pAJailed] == 1)
            {
                
format(stringsizeof(string), "%s (%i) Is Already In Jail.",PlayerInfo[giveplayerid][pName],giveplayerid);
                
SendClientMessage(playeridCOLOR_ERRORstring);
                return 
1;
            }
            if (
PlayerInfo[giveplayerid][pJailed] == 1)
            {
                
format(stringsizeof(string), "%s (%i) Is Already In Jail.",PlayerInfo[giveplayerid][pName],giveplayerid);
                
SendClientMessage(playeridCOLOR_ERRORstring);
                return 
1;
            }
            if (!
IsPlayerInAnyVehicle(playerid))
            {
                
ApplyAnimation(playerid"PED""ARRESTgun",3.0 ,,,,,,1);
            }
            if (!
IsPlayerInAnyVehicle(giveplayerid))
            {
                
ApplyAnimation(giveplayerid"PED",  "handsup"3.0000101);
            }
            
format(stringsizeof(string), "Suspect %s (%i) Has Been Arrested By Officer %s (%i)",PlayerInfo[giveplayerid][pName],giveplayerid,PlayerInfo[playerid][pName],playerid);
            
SendClientMessageToAll(COLOR_SERVER_HELP_MSGstring);
            
format(stringsizeof(string), "You Have Arrested Suspect %s (%d) And Recieved A Cop Takedown Bonus Of $5000.",PlayerInfo[giveplayerid][pName],giveplayerid);
            
SendClientMessage(playeridCOLOR_SERVER_HELP_MSGstring);
            
format(stringsizeof(string), "~b~Arrested %s",PlayerInfo[giveplayerid][pName]);
            
GameTextForPlayer(playerid,string30003);
            
ServerInfo[sCityArrests]++;
            
GivePlayerCash(playerid5000);
            
PlayerInfo[playerid][pEarnings] += 5000;
            
SetPlayerScore(playerid,GetPlayerScore(playerid) + 1);
            
SetPlayerScore(giveplayerid,GetPlayerScore(giveplayerid) - 1);
            
PlayerInfo[giveplayerid][pJailHour] =1*4;
            
PlayerInfo[giveplayerid][pJailMinute] = 1*PlayerInfo[giveplayerid][pWantedLevel];
            
PlayerInfo[giveplayerid][pBail] = PlayerInfo[giveplayerid][pWantedLevel]*1000;
            
format(stringsizeof(string), "BUSTED BY ~b~OFFICER %s",PlayerInfo[playerid][pName]);
            
GameTextForPlayer(giveplayerid,string10000);
            
format(stringsizeof(string), "You Have Been Arrested By Officer %s (%d). Minimum Sentence: %d Hours, %d Minutes Bail: $%d",PlayerInfo[playerid][pName],playeridPlayerInfo[giveplayerid][pJailHour],PlayerInfo[giveplayerid][pJailMinute],PlayerInfo[giveplayerid][pBail]);
            
SendClientMessage(giveplayeridCOLOR_SERVER_HELP_MSGstring);
            if (
PlayerInfo[giveplayerid][pHoldup] > && PlayerInfo[giveplayerid][pMission] == MISSION_TYPE_STORE_ROBBERY)
            {
                if (
PlayerInfo[giveplayerid][pHoldupAmount] > 0)
                {
                    
format(stringsizeof(string), "You Have Been Arrested. Holdup Failed. $%d Seized."PlayerInfo[giveplayerid][pHoldupAmount]);
                    
SendClientMessage(giveplayeridCOLOR_SERVER_HELP_MSGstring);
                    
SendClientMessage(playeridCOLOR_SERVER_HELP_MSG"You Have Stopped A Robbery And Received A $10000 Bonus.");
                    
GivePlayerCash(playerid10000);
                    
PlayerInfo[playerid][pEarnings] += 10000;
                }
            }
            
SetTimerEx("ArrestTimer"20000"d"playerid);
            
SetTimerEx("ArrestTimer"20000"d"giveplayerid);
            
TogglePlayerControllable(giveplayerid0);
            
SetPlayerWantedLevel(giveplayerid,0);
            
ResetPlayerWeapons(giveplayerid);
            
PlayerInfo[playerid][pArrests] ++;
            
PlayerInfo[giveplayerid][pArrested] ++;
            
IncreasePlayerRank(playerid);
        }else{
            
SendClientMessage(playeridCOLOR_ERROR"You Must Be A Law Enforcement Agent To Arrest Suspects.");
        }
    }else{
        
SendClientMessage(playeridCOLOR_ERROR"You Cannot Use This Command When You're Dead.");
    }
    return 
1;

Reply
#2

hey dude whats server new ip and port
Reply
#3

Quote:
Originally Posted by SPEEEDSTER
Посмотреть сообщение
hey dude whats server new ip and port
LOL

OT: Why would you store if a player spawned in an enum instead of making a Variable anyways, put PlayerInfo[playerid][pSpawn] = 1; in OnPlayerSpawn callback.
Reply
#4

Quote:
Originally Posted by DarkLored
Посмотреть сообщение
LOL

OT: Why would you store if a player spawned in an enum instead of making a Variable anyways, put PlayerInfo[playerid][pSpawn] = 1; in OnPlayerSpawn callback.
can you edit the posted script
and send me the whole one?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)