Checkpoint only showing for ID 0
#1

Hello I've made a back up command for LSPD but only ID 0 in the server is able to see the checkpoint.

This is the code:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext, "/bku", true) == 0)
        {
            if(IsACop(playerid))
            {
                new string[256];
                if(backuprequester[playerid] == 1) return SendClientMessage(playerid, COLOR_GREY, "You've requested backup already! (/bkc to cancel)");
                if(backuprequested == 1) return SendClientMessage(playerid, COLOR_GREY, "Someone else request backup already!");
                SendClientMessage(playerid, COLOR_GREY, "Type in /bkc to cancel the backup");
                new Float:x, Float:y, Float:z;
                GetPlayerPos(playerid, x,y,z);
                backuptimer[playerid] = SetTimerEx("updatebackup", 1000, true, "i", playerid);
                backuprequested = 1;
                backuprequester[playerid] = 1;
                for (new i = 0; i < MAX_PLAYERS; i++)
                {
                    new location[MAX_ZONE_NAME];
                    GetPlayer2DZone(playerid, location, MAX_ZONE_NAME);
                    format(string, sizeof(string), "* Dispatch: %s[%d] is in need of backup! Location at (%s)",GetPlayerNameEx(playerid),playerid, location);
                    SendPoliceMessage(i, COLOR_LIGHTBLUE, string);
                    SetPlayerCheckpoint(i, x, y, z, 5);
                    return 1;
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY, "[NOTE] You are not authorized to use this command!");
                return 1;
            }
        }
       
       
       
    if(strcmp(cmdtext, "/bkc", true) == 0)
        {
            if(IsACop(playerid))
            {
                new string[256];
                if(backuprequester[playerid] == 0) return SendClientMessage(playerid, COLOR_GREY, "You've not requested any backup!");
                KillTimer(backuptimer[playerid]);
                backuprequested = 0;
                backuprequester[playerid] = 0;
                for (new i = 0; i < MAX_PLAYERS; i++)
                {
                    format(string, sizeof(string), "* Dispatch: %s[%d] has canceled his backup", GetPlayerNameEx(playerid),playerid);
                    SendPoliceMessage(i, COLOR_LIGHTBLUE, string);
                    DisablePlayerCheckpoint(i);
                    return 1;
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY, "[NOTE] You are not authorized to use this command!");
                return 1;
            }
        }
    return 0;
}
Reply
#2

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext, "/bku", true) == 0)
        {
            if(IsACop(playerid))
            {
                new string[256];
                if(backuprequester[playerid] == 1) return SendClientMessage(playerid, COLOR_GREY, "You've requested backup already! (/bkc to cancel)");
                if(backuprequested == 1) return SendClientMessage(playerid, COLOR_GREY, "Someone else request backup already!");
                SendClientMessage(playerid, COLOR_GREY, "Type in /bkc to cancel the backup");
                new Float:x, Float:y, Float:z;
                GetPlayerPos(playerid, x,y,z);
                backuptimer[playerid] = SetTimerEx("updatebackup", 1000, true, "i", playerid);
                backuprequested = 1;
                backuprequester[playerid] = 1;
                for (new i = 0; i < MAX_PLAYERS; i++)
                {
                    new location[MAX_ZONE_NAME];
                    GetPlayer2DZone(playerid, location, MAX_ZONE_NAME);
                    format(string, sizeof(string), "* Dispatch: %s[%d] is in need of backup! Location at (%s)",GetPlayerNameEx(playerid),playerid, location);
                    SendPoliceMessage(i, COLOR_LIGHTBLUE, string);
                    SetPlayerCheckpoint(i, x, y, z, 5);
                    //return 1; you stopped the loop fully after it only looped once.
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY, "[NOTE] You are not authorized to use this command!");
                return 1;
            }
        }
       
       
       
    if(strcmp(cmdtext, "/bkc", true) == 0)
        {
            if(IsACop(playerid))
            {
                new string[256];
                if(backuprequester[playerid] == 0) return SendClientMessage(playerid, COLOR_GREY, "You've not requested any backup!");
                KillTimer(backuptimer[playerid]);
                backuprequested = 0;
                backuprequester[playerid] = 0;
                for (new i = 0; i < MAX_PLAYERS; i++)
                {
                    format(string, sizeof(string), "* Dispatch: %s[%d] has canceled his backup", GetPlayerNameEx(playerid),playerid);
                    SendPoliceMessage(i, COLOR_LIGHTBLUE, string);
                    DisablePlayerCheckpoint(i);
                    return 1;
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY, "[NOTE] You are not authorized to use this command!");
                // return 1;
            }
        }
    return 0;
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)