Resetplayerweapons doesn't work
#4

Quote:
Originally Posted by rfr
Посмотреть сообщение
Try this:
PHP код:
CMD:aduty(playeridparams[]) {
    if(
PlayerInfo[playerid][pAdmin] >= 2) {
        if(
strlen(PlayerInfo[playerid][pAdminName]) > && strlen(PlayerInfo[playerid][pAdminName]) < 20) {
            new
            
string[128];
            
            
            if(
AdminDuty[playerid] != 0) {
                if(
GetPlayerState(playerid) == PLAYER_STATE_WASTED)
                return 
SendClientMessage(playeridCOLOR_GRAD2"You can't do this while wasted.");
                
                
ResetPlayerWeapons(playerid);
                
SetPlayerArmedWeapon(playerid0);
                
                if(
Spectating[playerid] > && PlayerInfo[playerid][pAdmin] >= 2) {
                    
GettingSpectated[Spectate[playerid]] = 999;
                    
Spectating[playerid] = 0;
                    
Spectate[playerid] = 999;
                    
SetPVarInt(playerid"SpecOff"1);
                    
TogglePlayerSpectating(playeridfalse);
                    
SetCameraBehindPlayer(playerid);
                }
                
                
DeletePVar(playerid"MedicBill");
                
DeletePVar(playerid"HospitalTimer");
                
DeletePVar(playerid"Hospital");
                
DeletePVar(playerid"Injured");
                
DeletePVar(playerid"EMSAttempt");
                
DeletePVar(playerid"MedicCall");
                
                
TogglePlayerControllable(playerid1);
                
ClearAnimations(playerid);
                
PlayerCuffed[playerid] = 0;
                
PlayerCuffedTime[playerid] = 0;
                
DeletePVar(playerid"PlayerCuffed");
                
HouseOffer[playerid] = 999;
                
House[playerid] = 0;
                
HousePrice[playerid] = 0;
                
SexOffer[playerid] = 999;
                
SexPrice[playerid] = 0;
                
InviteOffer[playerid]=999;
                
//InviteFaction[playerid]=0;
                //InviteFamily[playerid]=255;
                
PotOffer[playerid] = 999;
                
CrackOffer[playerid] = 999;
                
PotPrice[playerid]=0;
                
CrackPrice[playerid]=0;
                
PotGram[playerid]=0;
                
CrackGram[playerid]=0;
                
JailPrice[playerid]=0;
                
DefendOffer[playerid] = 999;
                
DefendPrice[playerid] = 0;
                
GuardOffer[playerid] = 999;
                
GuardPrice[playerid]=0;
                
GunOffer[playerid] = 999;
                
GunId[playerid] = 0;
                
GunMats[playerid] = 0;
                
MatsOffer[playerid] = 999;
                
MatsPrice[playerid] = 0;
                
MatsAmount[playerid] = 0;
                
CraftOffer[playerid] = 999;
                
CraftId[playerid]=0;
                
CraftMats[playerid]=0;
                
VehicleOffer[playerid] = 999;
                
VehiclePrice[playerid] = 0;
                
VehicleId[playerid] = -1;
                
RepairCar[playerid]=0;
                
//OnDuty[playerid]=0;
                
TicketOffer[playerid] = 999;
                
TicketMoney[playerid] = 0;
                
arr_Towing[playerid] = INVALID_VEHICLE_ID;
                
GotHit[playerid]=0;
                
GoChase[playerid]=999;
                
GetChased[playerid]=999;
                
DivorceOffer[playerid] = 999;
                
MarryWitness[playerid] = 999;
                
MarryWitnessOffer[playerid] = 999;
                
MarriageCeremoney[playerid] = 0;
                
ProposeOffer[playerid] = 999;
                
ProposedTo[playerid] = 999;
                
GotProposedBy[playerid] = 999;
                
                
PhoneOnline[playerid] = 0;
                
                
DeletePVar(playerid"AdminUndercover");
                
                
/*                if(MP3Station[playerid] != 0) {
                MP3Station[playerid] = 0;
                StopAudioStreamForPlayer(playerid);
                }
                */
                
SetPlayerHealth(playeridPlayerInfo[playerid][pHealth]);
                
SetPlayerArmour(playeridPlayerInfo[playerid][pArmor]);
                
                
format(stringsizeof(string), "%s (ID %d - %s) is now off-duty as a Level %d Admin."PlayerInfo[playerid][pAdminName], playeridGetPlayerNameEx(playerid), PlayerInfo[playerid][pAdmin]);
                
ABroadCast(COLOR_WHITEstring1);
                
                if(
PlayerInfo[playerid][pAdmin] == 1) {
                    
SendClientMessage(playeridCOLOR_YELLOW"You're now off-duty as admin, but still have access to your Level 1 Admin commands.");
                } else if(
PlayerInfo[playerid][pAdmin] > && PlayerInfo[playerid][pAdmin] < 6) {
                    
SendClientMessage(playeridCOLOR_YELLOW"You're now off-duty as admin, and only have access to /admins /check /jail /ban /sban /kick /skick /showflags /reports /nrn");
                } else if(
PlayerInfo[playerid][pAdmin] == 6) {
                    
SendClientMessage(playeridCOLOR_YELLOW"You're now off-duty as admin, but still have access to all of your commands since you're a Level 6 Admin.");
                } else { }
                
                
SendClientMessage(playeridCOLOR_REALRED"Please remember to turn off any hacks you may have (press F12 to disable ******).");
                
                new 
username[MAX_PLAYER_NAME];
                
GetPVarString(playerid"tmpName"usernamesizeof(username));
                
SetPVarInt(playerid"TempName"0);
                
SetPlayerName(playeridusername);
                
                
//    OnPlayerConnect(giveplayerid, AdminRelogPassword[giveplayerid]);
                //AttemptPlayerLogin(playerid, AdminRelogPassword[playerid]);
            
}
            else
            {
                
PlayerInfo[playerid][pInt] = GetPlayerInterior(playerid);
                
PlayerInfo[playerid][pVW] = GetPlayerVirtualWorld(playerid);
                
GetPlayerIp(playeridPlayerInfo[playerid][pIP], 32);
                
GetPlayerPos(playeridPlayerInfo[playerid][pPos_x], PlayerInfo[playerid][pPos_y], PlayerInfo[playerid][pPos_z]);
                
GetPlayerFacingAngle(playeridPlayerInfo[playerid][pPos_r]);
                
GetPlayerHealth(playeridPlayerInfo[playerid][pHealth]);
                
GetPlayerArmour(playeridPlayerInfo[playerid][pArmor]);
                
g_mysql_SaveAccount(playerid);
                
                if(
IsValidDynamicObject(PlayerInfo[playerid][pWeedObject]))
                {
                    
DestroyDynamicObject(PlayerInfo[playerid][pWeedObject]);
                }
                
                
PhoneOnline[playerid] = 1;
                
                for(new 
0MAX_REPORTSi++)
                {
                    if(
Reports[i][ReportFrom] == playerid)
                    {
                        
Reports[i][ReportFrom] = 999;
                        
Reports[i][BeingUsed] = 0;
                        
Reports[i][TimeToExpire] = 0;
                    }
                }
                
                if(
GotHit[playerid] > 0)
                {
                    if(
GetChased[playerid] < 999)
                    {
                        if(
IsPlayerConnected(GetChased[playerid]))
                        {
                            
SendClientMessage(GetChased[playerid], COLOR_YELLOW"Your hit has left the server.");
                            
GoChase[GetChased[playerid]] = 999;
                        }
                    }
                }
                if(
GoChase[playerid] < 999)
                {
                    
GetChased[GoChase[playerid]] = 999;
                    
GotHit[GoChase[playerid]] = 999;
                }
                
                
SetPVarInt(playerid"TempName"1);
                new 
username[MAX_PLAYER_NAME];
                
GetPlayerName(playeridusernamesizeof(username));
                
SetPVarString(playerid"TempNameName"username);
                
                
AdminDuty[playerid] = 1;
                
format(stringsizeof(string), "%s (ID %d - %s) is now on-duty as a Level %d Admin.",PlayerInfo[playerid][pAdminName], playeridGetPlayerNameEx(playerid), PlayerInfo[playerid][pAdmin]);
                
ABroadCast(COLOR_WHITEstring1);
                
SendClientMessage(playeridCOLOR_YELLOW"You're now on-duty as admin and have access to all your commands, see /ah.");
                
                
SetPlayerName(playeridPlayerInfo[playerid][pAdminName]);
            }
        }
        else 
SendClientMessage(playeridCOLOR_WHITE"You need an admin name to go on-duty. Contact a Head Admin to have your admin name set.");
        }
    else 
SendClientMessage(playeridCOLOR_GRAD1"You're not authorized to use that command!");
        return 
1;

It works, but I'm only able to go onduty and can't go off duty.
Reply


Messages In This Thread
Resetplayerweapons doesn't work - by IndependentGaming - 10.03.2018, 15:56
Re: Resetplayerweapons doesn't work - by RxErT - 10.03.2018, 16:03
Re: Resetplayerweapons doesn't work - by rfr - 10.03.2018, 16:36
Re: Resetplayerweapons doesn't work - by IndependentGaming - 10.03.2018, 17:21

Forum Jump:


Users browsing this thread: 2 Guest(s)