PlayerPosition ? =D
#1

How do i make this..

This is Example: If you are on Los Angeles you go ON Duty admin, Then you go Philippines to go OFF duty, your position should be back on los angeles.

How do i make that?
Код:
CMD:aduty(playerid, params[]) {
	if(PlayerInfo[playerid][pAdmin] >= 2) {
		if(strlen(PlayerInfo[playerid][pAdminName]) > 2 && strlen(PlayerInfo[playerid][pAdminName]) < 20) {
		    new string[128];
 			if(PlayerInfo[playerid][pAdminDuty] != 0) {
				if(!doesAccountExist(PlayerInfo[playerid][pAdminName])) {
					if(Spectating[playerid] > 0 && PlayerInfo[playerid][pAdmin] >= 2) {
						GettingSpectated[Spectate[playerid]] = 999;
						Spectating[playerid] = 0;
						Spectate[playerid] = 999;
						SetPVarInt(playerid, "SpecOff", 1);
						TogglePlayerSpectating(playerid, false);
						SetCameraBehindPlayer(playerid);
					}

  					new pState = GetPlayerState(playerid);

					if(pState == PLAYER_STATE_WASTED) {
					    SendClientMessage(playerid, COLOR_GRAD2, "You can't do this while wasted.");
					    return 1;
					}

					DeletePVar(playerid, "MedicBill");
					DeletePVar(playerid, "HospitalTimer");
					DeletePVar(playerid, "Hospital");
	    			DeletePVar(playerid, "Injured");
    				DeletePVar(playerid, "EMSAttempt");
					DeletePVar(playerid, "MedicCall");

					TogglePlayerControllable(playerid, 1);
					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;


					DeletePVar(playerid, "AdminUndercover");

					new username[MAX_PLAYER_NAME];
					GetPVarString(playerid, "TempNameName", username, sizeof(username));
					SetPVarInt(playerid, "TempName", 0);
 					SetPlayerName(playerid, username);

  	 				PlayerInfo[playerid][pAdminDuty] = 0;
  	 				format(string, sizeof(string), "%s (ID %d - %s) is now off-duty as a Level %d Admin.", PlayerInfo[playerid][pAdminName], playerid, GetPlayerNameEx(playerid), PlayerInfo[playerid][pAdmin]);
  	 				ABroadCast(COLOR_WHITE, string, 1);


					if(PlayerInfo[playerid][pAdmin] > 2 && PlayerInfo[playerid][pAdmin] < 99999)
					{
					    SendClientMessage(playerid, COLOR_YELLOW, "You're now off-duty as admin, and only have access to /admins /check /jail /ban /sban /kick /skick /showflags /reports /nrn");
					}
					if(PlayerInfo[playerid][pAdmin] == 99999)
					{
					    SendClientMessage(playerid, COLOR_YELLOW, "You're now off-duty as admin, but still have access to all of your commands since you're a Server Owner");
				 	}

					//SetPVarInt(playerid, "F12Timer", SetTimerEx("F12Warning", 1000, true, "d", playerid));

					//OnPlayerLogin(playerid, AdminRelogPassword[playerid]);
					SetPlayerHealth(playerid, PlayerInfo[playerid][pHealth]);
					SetPlayerArmourEx(playerid, PlayerInfo[playerid][pArmor]);

				}
				else
				{
					SendClientMessage(playerid, COLOR_WHITE, "This name is already registered.");
				}
 			}
 			else
 			{
 				PlayerInfo[playerid][pInt] = GetPlayerInterior(playerid);
				PlayerInfo[playerid][pVW] = GetPlayerVirtualWorld(playerid);
				GetPlayerIp(playerid, PlayerInfo[playerid][pIP], 32);
				GetPlayerPos(playerid, PlayerInfo[playerid][pPos_x], PlayerInfo[playerid][pPos_y], PlayerInfo[playerid][pPos_z]);
				GetPlayerFacingAngle(playerid, PlayerInfo[playerid][pPos_r]);
 			    OnPlayerStatsUpdate(playerid);

 			    PhoneOnline[playerid] = 1;

				for(new i = 0; i < MAX_REPORTS; i++)
				{
	    			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(playerid, username, sizeof(username));
				SetPVarString(playerid, "TempNameName", username);

 		    	PlayerInfo[playerid][pAdminDuty] = 1;
 		    	format(string, sizeof(string), "%s (ID %d - %s) is now on-duty as a Level %d Admin.",PlayerInfo[playerid][pAdminName], playerid, GetPlayerNameEx(playerid), PlayerInfo[playerid][pAdmin]);
 		    	ABroadCast(COLOR_WHITE, string, 1);
 		    	SendClientMessage(playerid, COLOR_YELLOW, "You're now on-duty as admin and have access to all your commands, see /ah.");
 		    	SetPlayerName(playerid, PlayerInfo[playerid][pAdminName]);
 		    	SendClientMessage(playerid, COLOR_REALRED, "NOTE: {FFFFFF}Before you do anything shit in server please be remember to read the admin rules(/arules)");
 		    	SendClientMessage(playerid, COLOR_LIGHTBLUE, "Your health is automatically set to god mode");
    			SetPlayerName(playerid, PlayerInfo[playerid][pAdminName]);
    			return 1;
 			}
		}
		else SendClientMessage(playerid, COLOR_WHITE, "You need an admin name to go on-duty. Contact a Server Owner to have your admin name set.");
	}
	else SendClientMessage(playerid, COLOR_GRAD1, "You're not authorized to use that command!");
	return 1;
}
Reply
#2

Los Angeles = Las Venturas ?
Phillipines = ?

Go to the areas you wish to get the location of, in-game, and type /save. Go to My Documents - Gta San Andreas User Files - SAMP - savedpositions.txt.
Reply
#3

pawn Код:
CMD:aduty(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 2)
    {
        if(strlen(PlayerInfo[playerid][pAdminName]) > 2 && strlen(PlayerInfo[playerid][pAdminName]) < 20)
        {
            new string[128];
            if(PlayerInfo[playerid][pAdminDuty] != 0)
            {
                if(!doesAccountExist(PlayerInfo[playerid][pAdminName]))
                {
                    if(Spectating[playerid] > 0 && PlayerInfo[playerid][pAdmin] >= 2)
                    {
                        GettingSpectated[Spectate[playerid]] = 999;
                        Spectating[playerid] = 0;
                        Spectate[playerid] = 999;
                        SetPVarInt(playerid, "SpecOff", 1);
                        TogglePlayerSpectating(playerid, false);
                        SetCameraBehindPlayer(playerid);
                    }

                    new pState = GetPlayerState(playerid);

                    if(pState == PLAYER_STATE_WASTED)
                    {
                        SendClientMessage(playerid, COLOR_GRAD2, "You can't do this while wasted.");
                        return 1;
                    }

                    DeletePVar(playerid, "MedicBill");
                    DeletePVar(playerid, "HospitalTimer");
                    DeletePVar(playerid, "Hospital");
                    DeletePVar(playerid, "Injured");
                    DeletePVar(playerid, "EMSAttempt");
                    DeletePVar(playerid, "MedicCall");

                    TogglePlayerControllable(playerid, 1);
                    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;

                    DeletePVar(playerid, "AdminUndercover");

                    new username[MAX_PLAYER_NAME];
                    GetPVarString(playerid, "TempNameName", username, sizeof(username));
                    SetPVarInt(playerid, "TempName", 0);
                    SetPlayerName(playerid, username);

                    PlayerInfo[playerid][pAdminDuty] = 0;
                    format(string, sizeof(string), "%s (ID %d - %s) is now off-duty as a Level %d Admin.", PlayerInfo[playerid][pAdminName], playerid, GetPlayerNameEx(playerid), PlayerInfo[playerid][pAdmin]);
                    ABroadCast(COLOR_WHITE, string, 1);


                    if(PlayerInfo[playerid][pAdmin] > 2 && PlayerInfo[playerid][pAdmin] < 99999)
                    {
                        SendClientMessage(playerid, COLOR_YELLOW, "You're now off-duty as admin, and only have access to /admins /check /jail /ban /sban /kick /skick /showflags /reports /nrn");
                    }
                   
                    if(PlayerInfo[playerid][pAdmin] == 99999)
                    {
                        SendClientMessage(playerid, COLOR_YELLOW, "You're now off-duty as admin, but still have access to all of your commands since you're a Server Owner");
                    }

                    //SetPVarInt(playerid, "F12Timer", SetTimerEx("F12Warning", 1000, true, "d", playerid));

                    //OnPlayerLogin(playerid, AdminRelogPassword[playerid]);

                    SetPlayerPos(playerid, PlayerInfo[playerid][pPos_x], PlayerInfo[playerid][pPos_y], PlayerInfo[playerid][pPos_z]); // This should set player position back to where they were.
                    SetPlayerFacingAngle(playerid, PlayerInfo[playerid][pPos_r]); // This should set player angle back to where they were
                   
                    SetPlayerHealth(playerid, PlayerInfo[playerid][pHealth]);
                    SetPlayerArmourEx(playerid, PlayerInfo[playerid][pArmor]);

                }
                else
                {
                    SendClientMessage(playerid, COLOR_WHITE, "This name is already registered.");
                }
            }
            else
            {
                PlayerInfo[playerid][pInt] = GetPlayerInterior(playerid);
                PlayerInfo[playerid][pVW] = GetPlayerVirtualWorld(playerid);
                GetPlayerIp(playerid, PlayerInfo[playerid][pIP], 32);
                OnPlayerStatsUpdate(playerid);

                PhoneOnline[playerid] = 1;

                for(new i = 0; i < MAX_REPORTS; i++)
                {
                    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;
                }
               
                GetPlayerPos(playerid, PlayerInfo[playerid][pPos_x], PlayerInfo[playerid][pPos_y], PlayerInfo[playerid][pPos_z]);
                GetPlayerFacingAngle(playerid, PlayerInfo[playerid][pPos_r]);
               
                SetPlayerPos(playerid, x-coords here, y-coords here, z-coords here); // First to third row of coords in savedpositions.txt
                SetPlayerFacingAngle(playerid, angle coords here) // Fourth row of coords in savedpositions.txt

                SetPVarInt(playerid, "TempName", 1);
                new username[MAX_PLAYER_NAME];
                GetPlayerName(playerid, username, sizeof(username));
                SetPVarString(playerid, "TempNameName", username);

                PlayerInfo[playerid][pAdminDuty] = 1;
                format(string, sizeof(string), "%s (ID %d - %s) is now on-duty as a Level %d Admin.",PlayerInfo[playerid][pAdminName], playerid, GetPlayerNameEx(playerid), PlayerInfo[playerid][pAdmin]);
                ABroadCast(COLOR_WHITE, string, 1);
                SendClientMessage(playerid, COLOR_YELLOW, "You're now on-duty as admin and have access to all your commands, see /ah.");
                SetPlayerName(playerid, PlayerInfo[playerid][pAdminName]);
                SendClientMessage(playerid, COLOR_REALRED, "NOTE: {FFFFFF}Before you do anything shit in server please be remember to read the admin rules(/arules)");
                SendClientMessage(playerid, COLOR_LIGHTBLUE, "Your health is automatically set to god mode");
                SetPlayerName(playerid, PlayerInfo[playerid][pAdminName]);
                return 1;
            }
        }
        else SendClientMessage(playerid, COLOR_WHITE, "You need an admin name to go on-duty. Contact a Server Owner to have your admin name set.");
    }
    else SendClientMessage(playerid, COLOR_GRAD1, "You're not authorized to use that command!");
    return 1;
}
Try this. Stick your original admin duty command in Notepad or something then paste mine.
Make sure you rectify the player position and angle coordinates as shown in green ^.
Reply
#4

Quote:
Originally Posted by AphexCCFC
Посмотреть сообщение
Los Angeles = Las Venturas ?
Phillipines = ?

Go to the areas you wish to get the location of, in-game, and type /save. Go to My Documents - Gta San Andreas User Files - SAMP - savedpositions.txt.
dude its only example. i mean if you go somewhere before you go on duty then you go somewhere after you go off duty your position should be set on position where you go before you go on duty
Reply
#5

Read above
Reply
#6

Quote:
Originally Posted by AphexCCFC
Посмотреть сообщение
Read above
Thats not what i mean..

For example if you GO ON DUTY and you are on Rodeo then you go somewhere then you go off duty your position should be back on rodeo.

When you go somewhere where you go ON duty then you go OFF duty again your position should be set before you go on duty
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)