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
#2

Bump
Reply
#3

it maybe because dialog ids are mixed up.

try replace

pawn Код:
#define               DIALOG_GPS                     4
to

pawn Код:
#define               DIALOG_GPS                     4000
Reply
#4

Not working
Reply
#5

What exactly the GPS command does?
Reply
#6

Read the script?
It shows dialog, what ever I choose, it shows a red mark in the map, and once I enter checkpoint, the checkpoint dissapears..

Problem is Dialog is not showing
Reply
#7

pawn Код:
#define DIALOG_GPS      4

new GPS;
new gpsstr[256];
new bool:GPS_Activated[MAX_PLAYERS];

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

stock AddGPS(name[], Float:x, Float:y, Float:z)
{
    strcat(GPSInfo[GPS][gName],name,128);
    GPSInfo[GPS][gX] = x;
    GPSInfo[GPS][gY] = y;
    GPSInfo[GPS][gZ] = z;
    GPS++;
}

public ResetVariables(playerid)
{
    GPS_Activated[playerid] = false;
    return 1;
}
//

public OnPlayerEnterCheckpoint(playerid)
{
    if(GPS_Activated[playerid])
    {
        SendClientMessage(playerid, COLOR_GREEN, "[GPS]:You have arrived at your destenation.");
        DisablePlayerCheckpoint(playerid);
        GPS_Activated[playerid] = false;
    }
    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; i < GPS; i++)
        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;
            SetPlayerCheckpoint(playerid, GPSInfo[listitem][gX], GPSInfo[listitem][gY], GPSInfo[listitem][gZ],5.0);
            GPS_Activated[playerid] = true;
        }
    }
    return 1;
}

//============================================================================//
dcmd_gps(playerid,params[])
{
    #pragma unused params
    if(GPS_Activated[playerid]) SendClientMessage(playerid, COLOR_RED, "[GPS] Your GPS is already on.");
    else if(!IsPlayerInAnyVehicle(playerid))
    {
        SendClientMessage(playerid, COLOR_RED, "[GPS] You must be in a vehicle to use this command.");
        GPS_Activated[playerid] = false;
    }
    else
    {
        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] = true;
    }
    return 1;
}
//============================================================================//
dcmd_gpsoff(playerid,params[])
{
    #pragma unused params
    if(!GPS_Activated[playerid]) SendClientMessage(playerid, COLOR_RED, "[GPS] Your GPS isn't turned on.");
    else{
        DisablePlayerCheckpoint(playerid);
        SendClientMessage(playerid, COLOR_GREEN, "[GPS] You have turned off your GPS.");
        GPS_Activated[playerid] = false;
    }
    return 1;
}
Reply
#8

Quote:
Originally Posted by _Khaled_
Посмотреть сообщение
Read the script?
It shows dialog, what ever I choose, it shows a red mark in the map, and once I enter checkpoint, the checkpoint dissapears..

Problem is Dialog is not showing
If it's a filterscript:

http://forum.sa-mp.com/showpost.php?...34&postcount=2
Reply
#9

@Jeff it's not a filter script, should I add the onfilterscript into ongamemodeinit?
Reply
#10

Thanks guys, Done
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)