SA-MP Forums Archive
Problema con key state change - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Español/Spanish (https://sampforum.blast.hk/forumdisplay.php?fid=29)
+---- Thread: Problema con key state change (/showthread.php?tid=385782)



Problema con key state change - eltata22 - 17.10.2012

Hola amigos este es mi problema
COD:
Quote:

if (PRESSED(KEY_FIRE))
{
new vehid = GetPlayerVehicleID(playerid);
new model0 = GetVehicleModel(vehid);
if(model0 == 522 || model0 == 461 || model0 == 463 || model0 == 468 || model0 == 523)
{
new Float:Velocity[3];
GetVehicleVelocity(vehid, Velocity[0], Velocity[1], Velocity[2]);
if(Velocity[0] <1.3 && Velocity[1] < 1.3 && Velocity[0] > -1.3 && Velocity[1] > -1.3)
{
SetVehicleVelocity(vehid, Velocity[0]*2, Velocity[1]*2, 0.0);
if(countpos[playerid] == 0)
{
countpos[playerid] = 1;
if(model != 46
{
Flame[playerid][0] = CreateObject(18693, 0.0, 0.0, 0.0, 0.0, 0, 0, 0);
Flame[playerid][1] = CreateObject(18693, 0.0, 0.0, 0.0, 0.0, 0, 0, 0);
if(model0 == 522)
{
AttachObjectToVehicle(Flame[playerid][0], vehid, 0.194999, 0.439999, 0.044999, 86.429962, 0.000000, 0.000000);
AttachObjectToVehicle(Flame[playerid][1], vehid, -0.204999, 0.439999, 0.044999, 86.429962, 0.000000, 0.000000);
}
else if(model0 == 461)
{
AttachObjectToVehicle(Flame[playerid][0], vehid, -0.354999, 0.374999, -0.164999, 84.419967, 3.645001, 0.000000);
AttachObjectToVehicle(Flame[playerid][1], vehid, 0.135000, 0.374999, -0.164999, 84.419967, 3.645001, 0.000000);
}
else if(model0 == 463)
{
AttachObjectToVehicle(Flame[playerid][0], vehid, 0.164999, 0.909999, -0.379999, 86.429962, 3.645001, 0.000000);
AttachObjectToVehicle(Flame[playerid][1], vehid, -0.419999, 0.909999, -0.379999, 86.429962, 3.645001, 0.000000);
}
else if(model0 == 523)
{
AttachObjectToVehicle(Flame[playerid][0], vehid, -0.345999, 0.459999, -0.141999, 89.444953, 3.645001, 0.000000);
AttachObjectToVehicle(Flame[playerid][1], vehid, 0.119000, 0.459999, -0.141999, 89.444953, 3.645001, 0.000000);
}
}
else
{
Flame[playerid][0] = CreateObject(18693, 0.0, 0.0, 0.0, 0.0, 0, 0, 0);
AttachObjectToVehicle(Flame[playerid][0], vehid, -0.095999, 0.734999, 0.159999, 90.449951, 3.645001, 0.000000);
}
}
}
}
}
}
return 1;
}

mi problema es warning 209: function "OnPlayerKeyStateChange" should return a value

Espero que me puedan ayudar


Respuesta: Problema con key state change - Fluid016 - 17.10.2012

retorna 1 en el callback OnPlayerKeyStateChange


Respuesta: Problema con key state change - eltata22 - 17.10.2012

Men no me sirvio pero empeze a tocar y lo resolvi igual gracias por intentar


Respuesta: Problema con key state change - Fluid016 - 17.10.2012

Quote:
Originally Posted by eltata22
Посмотреть сообщение
Men no me sirvio pero empeze a tocar y lo resolvi igual gracias por intentar
Si si claro, seguro fue otra cosa.
De nada.


Respuesta: Problema con key state change - OTACON - 17.10.2012

pawn Код:
#include <a_samp>

#define PRESSED(%0) \
    (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))

new countpos[MAX_PLAYERS];
new Flame[MAX_PLAYERS][2];

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(PRESSED(KEY_FIRE))
    {
        new vehid = GetPlayerVehicleID(playerid);
        new model = GetVehicleModel(vehid);
        if(model == 522 || model == 461 || model == 463 || model == 468 || model == 523)
        {
            new Float:Velocity[3];
            GetVehicleVelocity(vehid, Velocity[0], Velocity[1], Velocity[2]);
            if(Velocity[0] <1.3 && Velocity[1] < 1.3 && Velocity[0] > -1.3 && Velocity[1] > -1.3)
            {
                SetVehicleVelocity(vehid, Velocity[0]*2, Velocity[1]*2, 0.0);
                if(countpos[playerid] == 0)
                {
                    countpos[playerid] = 1;
                    if(model != 46)
                    {
                        Flame[playerid][0] = CreateObject(18693, 0.0, 0.0, 0.0, 0.0, 0, 0, 0);
                        Flame[playerid][1] = CreateObject(18693, 0.0, 0.0, 0.0, 0.0, 0, 0, 0);
                        if(model == 522)
                        {
                            AttachObjectToVehicle(Flame[playerid][0], vehid, 0.194999, 0.439999, 0.044999, 86.429962, 0.000000, 0.000000);
                            AttachObjectToVehicle(Flame[playerid][1], vehid, -0.204999, 0.439999, 0.044999, 86.429962, 0.000000, 0.000000);
                        }
                        if(model == 461)
                        {
                            AttachObjectToVehicle(Flame[playerid][0], vehid, -0.354999, 0.374999, -0.164999, 84.419967, 3.645001, 0.000000);
                            AttachObjectToVehicle(Flame[playerid][1], vehid, 0.135000, 0.374999, -0.164999, 84.419967, 3.645001, 0.000000);
                        }
                        if(model == 463)
                        {
                            AttachObjectToVehicle(Flame[playerid][0], vehid, 0.164999, 0.909999, -0.379999, 86.429962, 3.645001, 0.000000);
                            AttachObjectToVehicle(Flame[playerid][1], vehid, -0.419999, 0.909999, -0.379999, 86.429962, 3.645001, 0.000000);
                        }
                        if(model == 523)
                        {
                            AttachObjectToVehicle(Flame[playerid][0], vehid, -0.345999, 0.459999, -0.141999, 89.444953, 3.645001, 0.000000);
                            AttachObjectToVehicle(Flame[playerid][1], vehid, 0.119000, 0.459999, -0.141999, 89.444953, 3.645001, 0.000000);
                        }
                        else
                        {
                            Flame[playerid][0] = CreateObject(18693, 0.0, 0.0, 0.0, 0.0, 0, 0, 0);
                            AttachObjectToVehicle(Flame[playerid][0], vehid, -0.095999, 0.734999, 0.159999, 90.449951, 3.645001, 0.000000);
                        }
                    }
                }
            }
        }
    }
    return 1;
}



Respuesta: Problema con key state change - eltata22 - 17.10.2012

Quote:
Originally Posted by GROVE22
Посмотреть сообщение
Si si claro, seguro fue otra cosa.
De nada.
es verdad men lo unico que tenia que hacer era poner
}
}
}
}
return 1;
}
return 1;
}
vos me dijistes cualquier cosa


Respuesta: Problema con key state change - Fluid016 - 17.10.2012

Quote:
Originally Posted by eltata22
Посмотреть сообщение
es verdad men lo unico que tenia que hacer era poner
}
}
}
}
return 1;
}
return 1;
}
vos me dijistes cualquier cosa
ESO QUE HICISTE ES RETORNAR 1 -.-
QUE VOS NO SEPAS LENGUAJE PAWN NO SIGNIFICA QUE LO QUE TE DIGAN Y NO LO ENTIENDAS ESTA MAL.-
LA PROXIMA VES FIJATE ANTES DE HABLAR.


Respuesta: Problema con key state change - eltata22 - 17.10.2012

Quote:
Originally Posted by GROVE22
Посмотреть сообщение
ESO QUE HICISTE ES RETORNAR 1 -.-
QUE VOS NO SEPAS LENGUAJE PAWN NO SIGNIFICA QUE LO QUE TE DIGAN Y NO LO ENTIENDAS ESTA MAL.-
LA PROXIMA VES FIJATE ANTES DE HABLAR.
y vos fijate lo que escribis no seas tan grosero ¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬


Respuesta: Problema con key state change - OTACON - 17.10.2012

el problema no estaba en el retum..

aca los errores:

pawn Код:
#include <a_samp>

#define PRESSED(%0) \
    (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))

new countpos[MAX_PLAYERS];
new Flame[MAX_PLAYERS][2];

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if (PRESSED(KEY_FIRE))
    {
        new vehid = GetPlayerVehicleID(playerid);
        new model0 = GetVehicleModel(vehid);
        if(model0 == 522 || model0 == 461 || model0 == 463 || model0 == 468 || model0 == 523)
        {
            new Float:Velocity[3];
            GetVehicleVelocity(vehid, Velocity[0], Velocity[1], Velocity[2]);
            if(Velocity[0] <1.3 && Velocity[1] < 1.3 && Velocity[0] > -1.3 && Velocity[1] > -1.3)
            {
                SetVehicleVelocity(vehid, Velocity[0]*2, Velocity[1]*2, 0.0);
                if(countpos[playerid] == 0)
                {
                    countpos[playerid] = 1;
                    if(model0 != 46) //aca te falto el ) y tienes definido model0 el GetVehicleModel y aca colocaste model
                    {
                        Flame[playerid][0] = CreateObject(18693, 0.0, 0.0, 0.0, 0.0, 0, 0, 0);
                        Flame[playerid][1] = CreateObject(18693, 0.0, 0.0, 0.0, 0.0, 0, 0, 0);
                        if(model0 == 522)
                        {
                            AttachObjectToVehicle(Flame[playerid][0], vehid, 0.194999, 0.439999, 0.044999, 86.429962, 0.000000, 0.000000);
                            AttachObjectToVehicle(Flame[playerid][1], vehid, -0.204999, 0.439999, 0.044999, 86.429962, 0.000000, 0.000000);
                        }
                        else if(model0 == 461)
                        {
                            AttachObjectToVehicle(Flame[playerid][0], vehid, -0.354999, 0.374999, -0.164999, 84.419967, 3.645001, 0.000000);
                            AttachObjectToVehicle(Flame[playerid][1], vehid, 0.135000, 0.374999, -0.164999, 84.419967, 3.645001, 0.000000);
                        }
                        else if(model0 == 463)
                        {
                            AttachObjectToVehicle(Flame[playerid][0], vehid, 0.164999, 0.909999, -0.379999, 86.429962, 3.645001, 0.000000);
                            AttachObjectToVehicle(Flame[playerid][1], vehid, -0.419999, 0.909999, -0.379999, 86.429962, 3.645001, 0.000000);
                        }
                        else if(model0 == 523)
                        {
                            AttachObjectToVehicle(Flame[playerid][0], vehid, -0.345999, 0.459999, -0.141999, 89.444953, 3.645001, 0.000000);
                            AttachObjectToVehicle(Flame[playerid][1], vehid, 0.119000, 0.459999, -0.141999, 89.444953, 3.645001, 0.000000);
                        }
                        //} //esta llave de mas.
                        else
                        {
                            Flame[playerid][0] = CreateObject(18693, 0.0, 0.0, 0.0, 0.0, 0, 0, 0);
                            AttachObjectToVehicle(Flame[playerid][0], vehid, -0.095999, 0.734999, 0.159999, 90.449951, 3.645001, 0.000000);
                        }
                    }
                }
            }
        }
    }
    return 1;
} //Aca mal Acomolado y no coninsidia con  el ke abria el public
----> https://sampwiki.blast.hk/wiki/Control_Structures#return


Respuesta: Problema con key state change - Fluid016 - 17.10.2012

Quote:
Originally Posted by bytytus
Посмотреть сообщение
el problema no estaba en el retum..

aca los errores:

pawn Код:
#include <a_samp>

#define PRESSED(%0) \
    (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))

new countpos[MAX_PLAYERS];
new Flame[MAX_PLAYERS][2];

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if (PRESSED(KEY_FIRE))
    {
        new vehid = GetPlayerVehicleID(playerid);
        new model0 = GetVehicleModel(vehid);
        if(model0 == 522 || model0 == 461 || model0 == 463 || model0 == 468 || model0 == 523)
        {
            new Float:Velocity[3];
            GetVehicleVelocity(vehid, Velocity[0], Velocity[1], Velocity[2]);
            if(Velocity[0] <1.3 && Velocity[1] < 1.3 && Velocity[0] > -1.3 && Velocity[1] > -1.3)
            {
                SetVehicleVelocity(vehid, Velocity[0]*2, Velocity[1]*2, 0.0);
                if(countpos[playerid] == 0)
                {
                    countpos[playerid] = 1;
                    if(model0 != 46) //aca te falto el ) y tienes definido model0 el GetVehicleModel y aca colocaste model
                    {
                        Flame[playerid][0] = CreateObject(18693, 0.0, 0.0, 0.0, 0.0, 0, 0, 0);
                        Flame[playerid][1] = CreateObject(18693, 0.0, 0.0, 0.0, 0.0, 0, 0, 0);
                        if(model0 == 522)
                        {
                            AttachObjectToVehicle(Flame[playerid][0], vehid, 0.194999, 0.439999, 0.044999, 86.429962, 0.000000, 0.000000);
                            AttachObjectToVehicle(Flame[playerid][1], vehid, -0.204999, 0.439999, 0.044999, 86.429962, 0.000000, 0.000000);
                        }
                        else if(model0 == 461)
                        {
                            AttachObjectToVehicle(Flame[playerid][0], vehid, -0.354999, 0.374999, -0.164999, 84.419967, 3.645001, 0.000000);
                            AttachObjectToVehicle(Flame[playerid][1], vehid, 0.135000, 0.374999, -0.164999, 84.419967, 3.645001, 0.000000);
                        }
                        else if(model0 == 463)
                        {
                            AttachObjectToVehicle(Flame[playerid][0], vehid, 0.164999, 0.909999, -0.379999, 86.429962, 3.645001, 0.000000);
                            AttachObjectToVehicle(Flame[playerid][1], vehid, -0.419999, 0.909999, -0.379999, 86.429962, 3.645001, 0.000000);
                        }
                        else if(model0 == 523)
                        {
                            AttachObjectToVehicle(Flame[playerid][0], vehid, -0.345999, 0.459999, -0.141999, 89.444953, 3.645001, 0.000000);
                            AttachObjectToVehicle(Flame[playerid][1], vehid, 0.119000, 0.459999, -0.141999, 89.444953, 3.645001, 0.000000);
                        }
                        //} //esta llave de mas.
                        else
                        {
                            Flame[playerid][0] = CreateObject(18693, 0.0, 0.0, 0.0, 0.0, 0, 0, 0);
                            AttachObjectToVehicle(Flame[playerid][0], vehid, -0.095999, 0.734999, 0.159999, 90.449951, 3.645001, 0.000000);
                        }
                    }
                }
            }
        }
    }
    return 1;
} //Aca mal Acomolado y no coninsidia con  el ke abria el public
----> https://sampwiki.blast.hk/wiki/Control_Structures#return
No voy a leer el codigo no tengo ganas y menos cuando no es para mi.
warning 209: function "OnPlayerKeyStateChange" should return a value

Espaсol: funciуn "OnPlayerKeyStateChange" debe devolver un valor
Por ende -.-
el warning que йl puso es por el return y si el cуdigo tiene mбs problemas aya йl.