GPS System
#1

Hello, I've been using some GPS System but I can't seem to find it on forums now :\
It's for Xteamer I think..

Whatever, point it
when I /gps, dialog doesn't appear.

pawn Код:
#define               DIALOG_GPS                     4

new GPS = 0;
new gpsstr[256];
new GPS_Activated[MAX_PLAYERS] = 0;

enum gInfo
{
        gName[128],
        Float:gX,
        Float:gY,
        Float:gZ
}
new GPSInfo[MAX_GPS][gInfo];

stock AddGPS(name[], Float:x, Float:y, Float:z)
{
        GPS++;
        format(GPSInfo[GPS][gName],256,"%s",name);
        GPSInfo[GPS][gX] = x;
        GPSInfo[GPS][gY] = y;
        GPSInfo[GPS][gZ] = z;
        return 1;
}

public ResetVariables(playerid)
{
    GPS_Activated[playerid] = 0;
}
//

public OnPlayerEnterCheckpoint(playerid)
{
        if(GPS_Activated[playerid] == 1)
        {
            SendClientMessage(playerid, COLOR_GREEN, "[GPS]:You have arrived at your destenation.");
            DisablePlayerCheckpoint(playerid);
            GPS_Activated[playerid] = 0;
        }
        return 1;
}

public OnFilterScriptInit()
{
        print("GPS System successfuly loaded!");

        AddGPS("Las Venturas Police Departement", 2289.99,2418.84,10.39);
        AddGPS("Las Venturas Fuckyea.", 2289.99,2418.84,10.39);

        for(new i = 0; i < GPS+1; i++)
    {
        if(i != 0)
        {
            if(i == 1) format(gpsstr,256,"%s\n",GPSInfo[i][gName]);
            if(i != 1) format(gpsstr,256,"%s%s\n",gpsstr,GPSInfo[i][gName]);
        }
    }
        return 1;
}

//Public OnDialogResponse.
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    new pname[MAX_PLAYER_NAME], string[63 + MAX_PLAYER_NAME];
switch(dialogid)
    {
        case DIALOG_GPS:
        {
            if(!response) return 1;
            if(listitem == GPS+1) return 1;
            SetPlayerCheckpoint(playerid, GPSInfo[listitem+1][gX], GPSInfo[listitem+1][gY], GPSInfo[listitem+1][gZ],5.0);
            GPS_Activated[playerid] = 1;
        }
    }
    return 1;
}

//============================================================================//
dcmd_gps(playerid,params[])
{
        #pragma unused params
        if(GPS_Activated[playerid] == 1) return SendClientMessage(playerid, COLOR_RED, "[GPS] Your GPS is already on.");
        if(!IsPlayerInAnyVehicle(playerid))
        {
            SendClientMessage(playerid, COLOR_RED, "[GPS] You must be in a vehicle to use this command.");
            GPS_Activated[playerid] = 0;
        }
        if(IsPlayerInAnyVehicle(playerid))
        {
          SendClientMessage(playerid, COLOR_GREEN,"[GPS] You have turned on your GPS.");
          ShowPlayerDialog(playerid, DIALOG_GPS, DIALOG_STYLE_LIST, "GPS:", gpsstr, "Choose", "Cancel");
          GPS_Activated[playerid] = 1;
        }
        return 1;
}
//============================================================================//
dcmd_gpsoff(playerid,params[])
{
    #pragma unused params
    if(GPS_Activated[playerid] == 0) return SendClientMessage(playerid, COLOR_RED, "[GPS] Your GPS isn't turned on.");
    if(GPS_Activated[playerid] == 1)
        {
            DisablePlayerCheckpoint(playerid);
            SendClientMessage(playerid, COLOR_GREEN, "[GPS] You have turned off your GPS.");
            GPS_Activated[playerid] = 0;
        }
        return 1;
}
That's the GPS System credits by Xteamer, but I just can't find out why the Dialog isn't showing.
No compiling error.

NOTE: Don't tell me to change OnPlayerDialogResponse, from Dialog name to Dialog ID, already tried that and didn't change.
Reply


Messages In This Thread
GPS System - by _Khaled_ - 31.08.2012, 19:08
Re: GPS System - by _Khaled_ - 31.08.2012, 22:20
Re: GPS System - by Kirollos - 31.08.2012, 22:29
Re: GPS System - by _Khaled_ - 31.08.2012, 23:35
Re: GPS System - by ThePhenix - 31.08.2012, 23:41
Re: GPS System - by _Khaled_ - 31.08.2012, 23:45
Re: GPS System - by Jefff - 31.08.2012, 23:53
Re: GPS System - by FalconX - 31.08.2012, 23:53
Re: GPS System - by _Khaled_ - 01.09.2012, 00:17
Re: GPS System - by _Khaled_ - 01.09.2012, 00:21

Forum Jump:


Users browsing this thread: 4 Guest(s)