Simple GPS system
#1

Im trying to make a simple GPS dialog, and this is the ENTIRE filterscript.

pawn Код:
// This is a comment
// uncomment the line below if you want to write a filterscript
#define FILTERSCRIPT

#include <a_samp>

#define GPS 1

#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print(" Simple Gps System Loaded");
    print("--------------------------------------\n");
    return 1;
}

public OnFilterScriptExit()
{
    return 1;
}

#endif

public OnPlayerConnect(playerid)
{
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    return 1;
}

public OnPlayerSpawn(playerid)
{
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    return 1;
}

public OnVehicleSpawn(vehicleid)
{
    return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
    return 1;
}

public OnPlayerText(playerid, text[])
{
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/gps", cmdtext, true, 10) == 0)
    {
        ShowPlayerDialog(playerid, GPS, DIALOG_STYLE_LIST, "GPS","Los Santos Police Department\nAll Saints Hospital\nGas Station\nBank\nBinco\nGym\nCity Hall\nTen Green Bottles\nJefferson Motel","Locate","Close");
        return 1;
    }
    return 0;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == GPS)
    {
        if(response)
        {
            if(listitem == 0)
            {
                SendClientMessage(playerid, 0xFFFFFFFF, "You have set a checkpoint at the LSPD.");
                SetPlayerCheckpoint(playerid, 1546.3517,-1675.6573,13.5621, 3.0);
            }
            if(listitem == 1)
            {
                SendClientMessage(playerid, 0xFFFFFFFF, "You have set a checkpoint at All Saints Hospital.");
                SetPlayerCheckpoint(playerid, 1185.5948,-1322.9104,13.5715, 3.0);
            }
            if(listitem == 2)
            {
                SendClientMessage(playerid, 0xFFFFFFFF, "You have set a checkpoint at the Gas Station.");
                SetPlayerCheckpoint(playerid, 1941.3828,-1760.5978,13.3828, 3.0);
            }
            if(listitem == 3)
            {
                SendClientMessage(playerid, 0xFFFFFFFF, "You have set a checkpoint at the Bank.");
                SetPlayerCheckpoint(playerid, 1462.6707,-1022.0826,23.8281, 3.0);
            }
            if(listitem == 4)
            {
                SendClientMessage(playerid, 0xFFFFFFFF, "You have set a checkpoint at Binco.");
                SetPlayerCheckpoint(playerid, 2245.0559,-1662.0505,15.4690, 3.0);
            }
            if(listitem == 5)
            {
                SendClientMessage(playerid, 0xFFFFFFFF, "You have set a checkpoint at the Gym.");
                SetPlayerCheckpoint(playerid, 2227.4465,-1722.9207,13.5539, 3.0);
            }
            if(listitem == 6)
            {
                SendClientMessage(playerid, 0xFFFFFFFF, "You have set a checkpoint at the City Hall.");
                SetPlayerCheckpoint(playerid, 1481.0353,-1745.7384,13.8007, 3.0);
            }
            if(listitem == 7)
            {
                SendClientMessage(playerid, 0xFFFFFFFF, "You have set a checkpoint at Ten Green Bottles (bar)");
                SetPlayerCheckpoint(playerid, 2309.7632,-1649.3855,14.4330, 3.0);
            }
            if(listitem == 8)
            {
                SendClientMessage(playerid, 0xFFFFFFFF, "You have set a checkpoint at the Jefferson Motel");
                SetPlayerCheckpoint(playerid, 2220.1082,-1143.4906,25.3721, 3.0);
            }
        }
    }
}


public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
    return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
    return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
    return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
    return 1;
}

public OnPlayerLeaveRaceCheckpoint(playerid)
{
    return 1;
}

public OnRconCommand(cmd[])
{
    return 1;
}

public OnPlayerRequestSpawn(playerid)
{
    return 1;
}

public OnObjectMoved(objectid)
{
    return 1;
}

public OnPlayerObjectMoved(playerid, objectid)
{
    return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
    return 1;
}

public OnVehicleMod(playerid, vehicleid, componentid)
{
    return 1;
}

public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
    return 1;
}

public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
    return 1;
}

public OnPlayerSelectedMenuRow(playerid, row)
{
    return 1;
}

public OnPlayerExitedMenu(playerid)
{
    return 1;
}

public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
    return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    return 1;
}

public OnRconLoginAttempt(ip[], password[], success)
{
    return 1;
}

public OnPlayerUpdate(playerid)
{
    return 1;
}

public OnPlayerStreamIn(playerid, forplayerid)
{
    return 1;
}

public OnPlayerStreamOut(playerid, forplayerid)
{
    return 1;
}

public OnVehicleStreamIn(vehicleid, forplayerid)
{
    return 1;
}

public OnVehicleStreamOut(vehicleid, forplayerid)
{
    return 1;
}

public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
    return 1;
}
WHen i do /gps, it shows the locations and locate and buttons, but when i double click on one of them, it goes to my old dialog i made, which was my rpgmenu shown here

Like... when i double click on the first one (LSPD) it goes to the first Message box on my rpgguide, im sorry if this is an obvious fix, but i am a newbie at pawn.

Please dont troll in the comments or im going to have to rape you in the mouth intil ur dick falls off,
thanks,
darealz
Reply
#2

It goes to ur old menu because you defined the same number for the dialogs.
You will need to change them
Reply
#3

SS??
Reply
#4

Quote:
Originally Posted by park4bmx
Посмотреть сообщение
It goes to ur old menu because you defined the same number for the dialogs.
You will need to change them
What Numbers entirely do u mean?

I changed the define?

pawn Код:
#define GPS 10000
GPS is not 1 no more, its 10000,
but now it doesnt show the old menu, but it doesnt show the client message Nor the checkpoint,
Help?
Reply
#5

This is the new code i have,
It still wont work,
Please tell me whats wrong,
and if you can,
please give me a working edited version of it.

pawn Код:
// This is a comment
// uncomment the line below if you want to write a filterscript
#define FILTERSCRIPT

#include <a_samp>

#define GPS 10000

#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print(" Simple Gps System Loaded");
    print("--------------------------------------\n");
    return 1;
}

public OnFilterScriptExit()
{
    return 1;
}

#endif

public OnPlayerConnect(playerid)
{
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    return 1;
}

public OnPlayerSpawn(playerid)
{
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    return 1;
}

public OnVehicleSpawn(vehicleid)
{
    return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
    return 1;
}

public OnPlayerText(playerid, text[])
{
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/gps", cmdtext, true, 10) == 0)
    {
        ShowPlayerDialog(playerid, GPS, DIALOG_STYLE_LIST, "GPS","Los Santos Police Department\nAll Saints Hospital\nGas Station\nBank\nBinco\nGym\nCity Hall\nTen Green Bottles\nJefferson Motel","Locate","Close");
        return 1;
    }
    return 0;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(dialogid == GPS) // Lookup the dialogid
    {
        case 1:
        {
            if(!response)
            {
                SendClientMessage(playerid, 0xFF0000FF, "You cancelled.");
                return 1; // We processed it
            }
            switch(listitem)
            {
                case 0:
                {
                SendClientMessage(playerid, 0xFFFFFFFF, "You have set a checkpoint at the LSPD.");
                SetPlayerCheckpoint(playerid, 1546.3517,-1675.6573,13.5621, 3.0);
                }
                case 1:
                {
                SendClientMessage(playerid, 0xFFFFFFFF, "You have set a checkpoint at All Saints Hospital.");
                SetPlayerCheckpoint(playerid, 1185.5948,-1322.9104,13.5715, 3.0);
                }
                case 2:
                {
                SendClientMessage(playerid, 0xFFFFFFFF, "You have set a checkpoint at the Gas Station.");
                SetPlayerCheckpoint(playerid, 1941.3828,-1760.5978,13.3828, 3.0);
                }
                case 3:
                {
                SendClientMessage(playerid, 0xFFFFFFFF, "You have set a checkpoint at the Bank.");
                SetPlayerCheckpoint(playerid, 1462.6707,-1022.0826,23.8281, 3.0);
                }
                case 4:
                {
                SendClientMessage(playerid, 0xFFFFFFFF, "You have set a checkpoint at Binco.");
                SetPlayerCheckpoint(playerid, 2245.0559,-1662.0505,15.4690, 3.0);
                }
                case 5:
                {
                SendClientMessage(playerid, 0xFFFFFFFF, "You have set a checkpoint at the Gym.");
                SetPlayerCheckpoint(playerid, 2227.4465,-1722.9207,13.5539, 3.0);
                }
                case 6:
                {
                SendClientMessage(playerid, 0xFFFFFFFF, "You have set a checkpoint at the City Hall.");
                SetPlayerCheckpoint(playerid, 1481.0353,-1745.7384,13.8007, 3.0);
                }
                case 7:
                {
                SendClientMessage(playerid, 0xFFFFFFFF, "You have set a checkpoint at Ten Green Bottles (bar)");
                SetPlayerCheckpoint(playerid, 2309.7632,-1649.3855,14.4330, 3.0);
                }
                case 8:
                {
                SendClientMessage(playerid, 0xFFFFFFFF, "You have set a checkpoint at the Jefferson Motel");
                SetPlayerCheckpoint(playerid, 2220.1082,-1143.4906,25.3721, 3.0);
                }
            }
        }
    }
    return 0;
 }


public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
    return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
    return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
    return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
    return 1;
}

public OnPlayerLeaveRaceCheckpoint(playerid)
{
    return 1;
}

public OnRconCommand(cmd[])
{
    return 1;
}

public OnPlayerRequestSpawn(playerid)
{
    return 1;
}

public OnObjectMoved(objectid)
{
    return 1;
}

public OnPlayerObjectMoved(playerid, objectid)
{
    return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
    return 1;
}

public OnVehicleMod(playerid, vehicleid, componentid)
{
    return 1;
}

public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
    return 1;
}

public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
    return 1;
}

public OnPlayerSelectedMenuRow(playerid, row)
{
    return 1;
}

public OnPlayerExitedMenu(playerid)
{
    return 1;
}

public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
    return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    return 1;
}

public OnRconLoginAttempt(ip[], password[], success)
{
    return 1;
}

public OnPlayerUpdate(playerid)
{
    return 1;
}

public OnPlayerStreamIn(playerid, forplayerid)
{
    return 1;
}

public OnPlayerStreamOut(playerid, forplayerid)
{
    return 1;
}

public OnVehicleStreamIn(vehicleid, forplayerid)
{
    return 1;
}

public OnVehicleStreamOut(vehicleid, forplayerid)
{
    return 1;
}

public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
    return 1;
}
Reply
#6

Try this at the Lookup the dialogid Part

pawn Код:
switch(dialogid) // Lookup the dialogid
    {
        case GPS:
        {
I could be wrong but try it. Hope i've helped.
Reply
#7

Quote:
Originally Posted by Vero
Посмотреть сообщение
Try this at the Lookup the dialogid Part

pawn Код:
switch(dialogid) // Lookup the dialogid
    {
        case GPS:
        {
I could be wrong but try it. Hope i've helped.
Sorry, this didnt work for me (unless its just me)
if anyone here can just post me an edit of my script (i dont care if its tested or not, but please test first) so i can use it, i cant seem to figure out whats wrong with it.
Reply
#8

so your saying it doesnt show the dialog?

try
pawn Код:
if (strcmp("/gps", cmdtext, false, 4) == 0)
Reply
#9

Quote:
Originally Posted by Donya
Посмотреть сообщение
so your saying it doesnt show the dialog?

try
pawn Код:
if (strcmp("/gps", cmdtext, false, 4) == 0)
No, no, no... no.......

Dialog shows up, but when i double click one (or click locate or cancel) it doesnt show the message nor the checkpoint.
Reply
#10

are you using a streamer for checkpoints?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)