un error y un warning --
#1

instale el gps de MattHudson este http://pawnscript.com/foro/viewtopic.php?f=40&t=19608 y me sale estos errores lo tengo instalado tal y como el me dijo:
Код:
C:\Users\hp\Desktop\Mi servidor\gamemodes\gm.pwn(813) : warning 219: local variable "X" shadows a variable at a preceding level
C:\Users\hp\Desktop\Mi servidor\gamemodes\gm.pwn(813) : warning 219: local variable "Y" shadows a variable at a preceding level
C:\Users\hp\Desktop\Mi servidor\gamemodes\gm.pwn(813) : warning 219: local variable "Z" shadows a variable at a preceding level
C:\Users\hp\Desktop\Mi servidor\gamemodes\gm.pwn(814) : error 035: argument type mismatch (argument 2)
C:\Users\hp\Desktop\Mi servidor\gamemodes\gm.pwn(815) : warning 213: tag mismatch
C:\Users\hp\Desktop\Mi servidor\gamemodes\gm.pwn(816) : warning 213: tag mismatch
C:\Users\hp\Desktop\Mi servidor\gamemodes\gm.pwn(817) : warning 213: tag mismatch
C:\Users\hp\Desktop\Mi servidor\gamemodes\gm.pwn(813) : warning 203: symbol is never used: "Z"
C:\Users\hp\Desktop\Mi servidor\gamemodes\gm.pwn(813) : warning 203: symbol is never used: "Y"
C:\Users\hp\Desktop\Mi servidor\gamemodes\gm.pwn(813) : warning 203: symbol is never used: "X"
Pawn compiler 3.10.2	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
LA lineas
Код:
 new Float:X, Float:Y, Float:Z;
    GetPlayerPos(playerid, X, Y, Z);
    InfoGPS[playerid][pGPSCoordsX][id] = X;
    InfoGPS[playerid][pGPSCoordsY][id] = Y;
    InfoGPS[playerid][pGPSCoordsZ][id] = Z;
estuve mirando y no se como solucionarlo he de decir que mi gm base de KRISTIAN https://sampforum.blast.hk/showthread.php?tid=584148 via MYSQL
Reply
#2

Tu error es bastante sencillo amigo.
Lo que pasa es que esa variable X, Y, Z, ya las tienes creadas como globales y las estas volviendo a crear en ese cуdigo, cuando crees una variable global dale un nombre que la identifique mejor.


La soluciуn para esto es la siguiente
PHP код:
 new Float:posgpsXFloat:posgpsYFloat:posgpsZ;
    
GetPlayerPos(playeridposgpsXposgpsYposgpsZ);
    
InfoGPS[playerid][pGPSCoordsX][id] = posgpsX;
    
InfoGPS[playerid][pGPSCoordsY][id] = posgpsY;
    
InfoGPS[playerid][pGPSCoordsZ][id] = posgpsZ
Reply
#3

Код:
GetPlayerPos
(
	playerid,
	InfoGPS[playerid][pGPSCoordsX][id],
	InfoGPS[playerid][pGPSCoordsY][id],
	InfoGPS[playerid][pGPSCoordsZ][id]
);
Reply
#4

Quote:
Originally Posted by adri1
Посмотреть сообщение
Код:
GetPlayerPos
(
	playerid,
	InfoGPS[playerid][pGPSCoordsX][id],
	InfoGPS[playerid][pGPSCoordsY][id],
	InfoGPS[playerid][pGPSCoordsZ][id]
);
Vaya que buena idea jaja, allн se almacenarнa sus posiciones sin tener que hacer todo lo demбs, las dos le funcionaran pero me gusto mas tu forma xD.
Reply
#5

gracias ya esta
Reply
#6

Quote:
Originally Posted by Swankeh
Посмотреть сообщение
Tu error es bastante sencillo amigo.
Lo que pasa es que esa variable X, Y, Z, ya las tienes creadas como globales y las estas volviendo a crear en ese cуdigo, cuando crees una variable global dale un nombre que la identifique mejor.


La soluciуn para esto es la siguiente
PHP код:
 new Float:posgpsXFloat:posgpsYFloat:posgpsZ;
    
GetPlayerPos(playeridposgpsXposgpsYposgpsZ);
    
InfoGPS[playerid][pGPSCoordsX][id] = posgpsX;
    
InfoGPS[playerid][pGPSCoordsY][id] = posgpsY;
    
InfoGPS[playerid][pGPSCoordsZ][id] = posgpsZ
Cuando lo pongo me carga el punto se ve en el minimapa y voy a hacia el y no se va se queda ahi quieto sin irse.
Reply
#7

Si pones un checkpoint pбsame el cуdigo de tus checkpoint y me dices cuбl de todos es, de allн lo reviso y te digo que tienes que hacer vale
Reply
#8

mira todo esto es lo que tengo
PHP код:
#define    GEPEESES    (12345)
enum GPSID
{
    
FloatpGPSCoordsX[10],
    
FloatpGPSCoordsY[10],
    
FloatpGPSCoordsZ[10],
    
pGPSName0[36],
    
pGPSName1[36],
    
pGPSName2[36],
    
pGPSName3[36],
    
pGPSName4[36],
    
pGPSName5[36],
    
pGPSName6[36],
    
pGPSName7[36],
    
pGPSName8[36],
    
pGPSName9[36]
}
new 
InfoGPS[MAX_PLAYERS][GPSID];
CMD:ayudagps(playeridparams[])
{
    
SendClientMessage(playerid, -1"SISTEMA DE GPS POR USUARIO- Comandos: /editarmigps - /migps");
}
CMD:editarmigps(playeridparams[])
{
    new 
Opcion[20], idExtra[30];
    if(
sscanf(params"s[20]ds[30]"OpcionidExtra)) return SendClientMessage(playerid, -1"USO: /editarmigps [Opcion(Borrar-Crear-Nombre)][Slot][Nombre(Solo en uso de Opcion *Nombre*, default: 0)]");
    if(
id || id 9) return SendClientMessage(playerid, -1"{FFFF00}[ERROR]:{FFFFFF} Slot maximo: 9, slot minimo: 0");
    if(
strcmp(Opcion"borrar"true) == 0)
    {
        
InfoGPS[playerid][pGPSCoordsX][id] = 0.0;
        
InfoGPS[playerid][pGPSCoordsY][id] = 0.0;
        
InfoGPS[playerid][pGPSCoordsZ][id] = 0.0;
        new 
_PSstring[128];
        
format(_PSstringsizeof(_PSstring), "Has borrado el slot #%d de tu GPS."id);
        
SendClientMessage(playerid, -1_PSstring);
    }
    if(
strcmp(Opcion"crear"true) == 0)
    {
    new 
Float:posgpsXFloat:posgpsYFloat:posgpsZ
    
GetPlayerPos(playeridposgpsXposgpsYposgpsZ); 
    
InfoGPS[playerid][pGPSCoordsX][id] = posgpsX
    
InfoGPS[playerid][pGPSCoordsY][id] = posgpsY
    
InfoGPS[playerid][pGPSCoordsZ][id] = posgpsZ;  
        switch(
id)
        {
            case 
0format(InfoGPS[playerid][pGPSName0], 36"Punto guardado.");
            case 
1format(InfoGPS[playerid][pGPSName1], 36"Punto guardado.");
            case 
2format(InfoGPS[playerid][pGPSName2], 36"Punto guardado.");
            case 
3format(InfoGPS[playerid][pGPSName3], 36"Punto guardado.");
             case 
4format(InfoGPS[playerid][pGPSName4], 36"Punto guardado.");
            case 
5format(InfoGPS[playerid][pGPSName5], 36"Punto guardado.");
            case 
6format(InfoGPS[playerid][pGPSName6], 36"Punto guardado.");
            case 
7format(InfoGPS[playerid][pGPSName7], 36"Punto guardado.");
            case 
8format(InfoGPS[playerid][pGPSName8], 36"Punto guardado.");
            case 
9format(InfoGPS[playerid][pGPSName9], 36"Punto guardado.");
        }
        new 
_PSstring[128];
        
format(_PSstringsizeof(_PSstring), "Has creado el slot #%d(%s)de tu GPS."idExtra);
        
SendClientMessage(playerid, -1_PSstring);
    }
    if(
strcmp(Opcion"nombre"true) == 0)
    {
        switch(
id)
        {
            case 
0format(InfoGPS[playerid][pGPSName0], 36"%s"Extra);
            case 
1format(InfoGPS[playerid][pGPSName1], 36"%s"Extra);
            case 
2format(InfoGPS[playerid][pGPSName2], 36"%s"Extra);
            case 
3format(InfoGPS[playerid][pGPSName3], 36"%s"Extra);
             case 
4format(InfoGPS[playerid][pGPSName4], 36"%s"Extra);
            case 
5format(InfoGPS[playerid][pGPSName5], 36"%s"Extra);
            case 
6format(InfoGPS[playerid][pGPSName6], 36"%s"Extra);
            case 
7format(InfoGPS[playerid][pGPSName7], 36"%s"Extra);
            case 
8format(InfoGPS[playerid][pGPSName8], 36"%s"Extra);
            case 
9format(InfoGPS[playerid][pGPSName9], 36"%s"Extra);
        }
        new 
_PSstring[128];
        
format(_PSstringsizeof(_PSstring), "Has cambiado el nombre del slot #%d de tu GPS a *%s*."idExtra);
        
SendClientMessage(playerid, -1_PSstring);
    }
    return 
1;
}
CMD:migps(playeridparams[]) 
{
    new 
dialog[36*10], string[128];
    new 
nombre[300], Nombre2[36];
    for(new 
010i++)
    {
        switch(
i)
        {
               case 
0format(Nombre236"%s"InfoGPS[playerid][pGPSName0]);
            case 
1format(Nombre236"%s"InfoGPS[playerid][pGPSName1]);
            case 
2format(Nombre236"%s"InfoGPS[playerid][pGPSName2]);
            case 
3format(Nombre236"%s"InfoGPS[playerid][pGPSName3]);
             case 
4format(Nombre236"%s"InfoGPS[playerid][pGPSName4]);
            case 
5format(Nombre236"%s"InfoGPS[playerid][pGPSName5]);
            case 
6format(Nombre236"%s"InfoGPS[playerid][pGPSName6]);
            case 
7format(Nombre236"%s"InfoGPS[playerid][pGPSName7]);
            case 
8format(Nombre236"%s"InfoGPS[playerid][pGPSName8]);
            case 
9format(Nombre236"%s"InfoGPS[playerid][pGPSName9]);
        }
        if(
InfoGPS[playerid][pGPSCoordsX][i] == 0.0 && InfoGPS[playerid][pGPSCoordsY][i] == 0.0 && InfoGPS[playerid][pGPSCoordsZ][i] == 0.0)
        {
            
format(stringsizeof(string), "\n{FFFFFF}%d| Slot sin uso"i);
            
strcat(dialogstring);
        }
        else
        {
            
format(stringsizeof(string), "\n{FFFFFF}%d| %s [a %0.2f mts.]"iNombre2GetPlayerDistanceFromPoint(playeridInfoGPS[playerid][pGPSCoordsX][i], InfoGPS[playerid][pGPSCoordsY][i], InfoGPS[playerid][pGPSCoordsZ][i]));
            
strcat(dialogstring);
        }
    }
    
format(nombresizeof(nombre), "GPS");
    
ShowPlayerDialog(playeridGEPEESESDIALOG_STYLE_LISTnombredialog"Sacar""Salir");
    return 
1;
}
public 
OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    if(
dialogid == GEPEESES)
    {
          if(!
response)
        {
               return 
1;
        }
           new 
listitem;
           if(
>= && <= 9)
           {
               if(
InfoGPS[playerid][pGPSCoordsX][i] == 0.0 && InfoGPS[playerid][pGPSCoordsY][i] == 0.0 && InfoGPS[playerid][pGPSCoordsZ][i] == 0.0) return SendClientMessage(playerid, -1"Este slot no esta creado");
            new 
Float:Flotantes[3];
            
Flotantes[0] = InfoGPS[playerid][pGPSCoordsX][i];
            
Flotantes[1] = InfoGPS[playerid][pGPSCoordsY][i];
            
Flotantes[2] = InfoGPS[playerid][pGPSCoordsZ][i];
            
SetPlayerCheckpoint(playeridFlotantes[0], Flotantes[1], Flotantes[2], 5.0);
            
SendClientMessage(playerid, -1"Has seleccionado un punto de tu GPS. Coordenadas marcadas en el mapa.");
           }
    }
    return 
1;

Reply
#9

Quote:
Originally Posted by TwunZ
Посмотреть сообщение
mira todo esto es lo que tengo
PHP код:
#define    GEPEESES    (12345)
enum GPSID
{
    
FloatpGPSCoordsX[10],
    
FloatpGPSCoordsY[10],
    
FloatpGPSCoordsZ[10],
    
pGPSName0[36],
    
pGPSName1[36],
    
pGPSName2[36],
    
pGPSName3[36],
    
pGPSName4[36],
    
pGPSName5[36],
    
pGPSName6[36],
    
pGPSName7[36],
    
pGPSName8[36],
    
pGPSName9[36]
}
new 
InfoGPS[MAX_PLAYERS][GPSID];
CMD:ayudagps(playeridparams[])
{
    
SendClientMessage(playerid, -1"SISTEMA DE GPS POR USUARIO- Comandos: /editarmigps - /migps");
}
CMD:editarmigps(playeridparams[])
{
    new 
Opcion[20], idExtra[30];
    if(
sscanf(params"s[20]ds[30]"OpcionidExtra)) return SendClientMessage(playerid, -1"USO: /editarmigps [Opcion(Borrar-Crear-Nombre)][Slot][Nombre(Solo en uso de Opcion *Nombre*, default: 0)]");
    if(
id || id 9) return SendClientMessage(playerid, -1"{FFFF00}[ERROR]:{FFFFFF} Slot maximo: 9, slot minimo: 0");
    if(
strcmp(Opcion"borrar"true) == 0)
    {
        
InfoGPS[playerid][pGPSCoordsX][id] = 0.0;
        
InfoGPS[playerid][pGPSCoordsY][id] = 0.0;
        
InfoGPS[playerid][pGPSCoordsZ][id] = 0.0;
        new 
_PSstring[128];
        
format(_PSstringsizeof(_PSstring), "Has borrado el slot #%d de tu GPS."id);
        
SendClientMessage(playerid, -1_PSstring);
    }
    if(
strcmp(Opcion"crear"true) == 0)
    {
    new 
Float:posgpsXFloat:posgpsYFloat:posgpsZ
    
GetPlayerPos(playeridposgpsXposgpsYposgpsZ); 
    
InfoGPS[playerid][pGPSCoordsX][id] = posgpsX
    
InfoGPS[playerid][pGPSCoordsY][id] = posgpsY
    
InfoGPS[playerid][pGPSCoordsZ][id] = posgpsZ;  
        switch(
id)
        {
            case 
0format(InfoGPS[playerid][pGPSName0], 36"Punto guardado.");
            case 
1format(InfoGPS[playerid][pGPSName1], 36"Punto guardado.");
            case 
2format(InfoGPS[playerid][pGPSName2], 36"Punto guardado.");
            case 
3format(InfoGPS[playerid][pGPSName3], 36"Punto guardado.");
             case 
4format(InfoGPS[playerid][pGPSName4], 36"Punto guardado.");
            case 
5format(InfoGPS[playerid][pGPSName5], 36"Punto guardado.");
            case 
6format(InfoGPS[playerid][pGPSName6], 36"Punto guardado.");
            case 
7format(InfoGPS[playerid][pGPSName7], 36"Punto guardado.");
            case 
8format(InfoGPS[playerid][pGPSName8], 36"Punto guardado.");
            case 
9format(InfoGPS[playerid][pGPSName9], 36"Punto guardado.");
        }
        new 
_PSstring[128];
        
format(_PSstringsizeof(_PSstring), "Has creado el slot #%d(%s)de tu GPS."idExtra);
        
SendClientMessage(playerid, -1_PSstring);
    }
    if(
strcmp(Opcion"nombre"true) == 0)
    {
        switch(
id)
        {
            case 
0format(InfoGPS[playerid][pGPSName0], 36"%s"Extra);
            case 
1format(InfoGPS[playerid][pGPSName1], 36"%s"Extra);
            case 
2format(InfoGPS[playerid][pGPSName2], 36"%s"Extra);
            case 
3format(InfoGPS[playerid][pGPSName3], 36"%s"Extra);
             case 
4format(InfoGPS[playerid][pGPSName4], 36"%s"Extra);
            case 
5format(InfoGPS[playerid][pGPSName5], 36"%s"Extra);
            case 
6format(InfoGPS[playerid][pGPSName6], 36"%s"Extra);
            case 
7format(InfoGPS[playerid][pGPSName7], 36"%s"Extra);
            case 
8format(InfoGPS[playerid][pGPSName8], 36"%s"Extra);
            case 
9format(InfoGPS[playerid][pGPSName9], 36"%s"Extra);
        }
        new 
_PSstring[128];
        
format(_PSstringsizeof(_PSstring), "Has cambiado el nombre del slot #%d de tu GPS a *%s*."idExtra);
        
SendClientMessage(playerid, -1_PSstring);
    }
    return 
1;
}
CMD:migps(playeridparams[]) 
{
    new 
dialog[36*10], string[128];
    new 
nombre[300], Nombre2[36];
    for(new 
010i++)
    {
        switch(
i)
        {
               case 
0format(Nombre236"%s"InfoGPS[playerid][pGPSName0]);
            case 
1format(Nombre236"%s"InfoGPS[playerid][pGPSName1]);
            case 
2format(Nombre236"%s"InfoGPS[playerid][pGPSName2]);
            case 
3format(Nombre236"%s"InfoGPS[playerid][pGPSName3]);
             case 
4format(Nombre236"%s"InfoGPS[playerid][pGPSName4]);
            case 
5format(Nombre236"%s"InfoGPS[playerid][pGPSName5]);
            case 
6format(Nombre236"%s"InfoGPS[playerid][pGPSName6]);
            case 
7format(Nombre236"%s"InfoGPS[playerid][pGPSName7]);
            case 
8format(Nombre236"%s"InfoGPS[playerid][pGPSName8]);
            case 
9format(Nombre236"%s"InfoGPS[playerid][pGPSName9]);
        }
        if(
InfoGPS[playerid][pGPSCoordsX][i] == 0.0 && InfoGPS[playerid][pGPSCoordsY][i] == 0.0 && InfoGPS[playerid][pGPSCoordsZ][i] == 0.0)
        {
            
format(stringsizeof(string), "\n{FFFFFF}%d| Slot sin uso"i);
            
strcat(dialogstring);
        }
        else
        {
            
format(stringsizeof(string), "\n{FFFFFF}%d| %s [a %0.2f mts.]"iNombre2GetPlayerDistanceFromPoint(playeridInfoGPS[playerid][pGPSCoordsX][i], InfoGPS[playerid][pGPSCoordsY][i], InfoGPS[playerid][pGPSCoordsZ][i]));
            
strcat(dialogstring);
        }
    }
    
format(nombresizeof(nombre), "GPS");
    
ShowPlayerDialog(playeridGEPEESESDIALOG_STYLE_LISTnombredialog"Sacar""Salir");
    return 
1;
}
public 
OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    if(
dialogid == GEPEESES)
    {
          if(!
response)
        {
               return 
1;
        }
           new 
listitem;
           if(
>= && <= 9)
           {
               if(
InfoGPS[playerid][pGPSCoordsX][i] == 0.0 && InfoGPS[playerid][pGPSCoordsY][i] == 0.0 && InfoGPS[playerid][pGPSCoordsZ][i] == 0.0) return SendClientMessage(playerid, -1"Este slot no esta creado");
            new 
Float:Flotantes[3];
            
Flotantes[0] = InfoGPS[playerid][pGPSCoordsX][i];
            
Flotantes[1] = InfoGPS[playerid][pGPSCoordsY][i];
            
Flotantes[2] = InfoGPS[playerid][pGPSCoordsZ][i];
            
SetPlayerCheckpoint(playeridFlotantes[0], Flotantes[1], Flotantes[2], 5.0);
            
SendClientMessage(playerid, -1"Has seleccionado un punto de tu GPS. Coordenadas marcadas en el mapa.");
           }
    }
    return 
1;

Agrega esto, pero lo tienes que ir modificando mediante vayas creando mas checkpoints, en si puedes mandarle un mensaje diciйndole que llego a su destino.

PHP код:
public OnPlayerEnterCheckpoint(playerid)
{
    
DisablePlayerCheckpoint(playerid);
    return 
1;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)