SA-MP Forums Archive
Ayuda Con esta funcion... - 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: Ayuda Con esta funcion... (/showthread.php?tid=419726)



Ayuda Con esta funcion... - OTACON - 02.03.2013

Buenas a Todos, Cree un stock para detectar e retornar el id del vehiculo mas cercano al player correspondiente, pero no se ke esta mal ke me devuelve siempre en 0 :S .

pawn Код:
stock JugadorCerca(playerid, Float:distancia) {
    new count=0, idveh=0, Float:pos[3];
    GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
    for(new v = 1; v < MAX_VEHICLES; v++) {
    if(IsVehicleStreamedIn(v, playerid) && IsVehicleInRangeOfPoint(v, distancia, pos[0], pos[1], pos[2]))
    { count++; break; }
    switch(count) {
        case 1: idveh = v; }
    }
    return idveh;
}
---------------------------------------------------

y con esto tambien tengo problemas, se me repite el texto ke iria en los %s.
pawn Код:
new TextoString[MAX_PLAYERS][30][3];

new str[128];
format(str, sizeof(str), "\
Texto String 1: %s \n\
Texto String 2: %s \n\
Texto String 3: %s \
"
, TextoString[playerid][0], TextoString[playerid][1], TextoString[playerid][2]);

TextoString[playerid][0] = "\0";
format(TextoString[playerid][0],7,"123456",TextoString[playerid][0]);

TextoString[playerid][1] = "\0";
format(TextoString[playerid][1],4,"123",TextoString[playerid][1]);

TextoString[playerid][2] = "\0";
format(TextoString[playerid][2],5,"1234",TextoString[playerid][2]);
Si me puden ayudar se los agradezco.
Desde yam uchas Gracias ;9.


Respuesta: Ayuda Con esta funcion... - [J]ulian - 02.03.2013

Para lo primero usa GetClosestVehicle, en la secciуn de ingles estб.
Para lo segundo usa [3][30], creo que ahн estб el problema.


Respuesta: Ayuda Con esta funcion... - OTACON - 02.03.2013

Quote:
Originally Posted by [J]ulian
Посмотреть сообщение
Para lo primero usa GetClosestVehicle, en la secciуn de ingles estб.
Para lo segundo usa [3][30], creo que ahн estб el problema.
Gracias, lo primero si era eso, estaban arrevez .
y lo segundo , quisiera saber que esta mal en ese :S.
por ke si lo utilizo sin el stock y lo uso directo y coloco la funcion en el case me funciona perfecto, raro :S.


EDIT:

ya solucione, estaba de mas el switch .
Gracias.


Respuesta: Ayuda Con esta funcion... - [J]ulian - 02.03.2013

No es que estaba de mбs, si no que al estar dentro del bucle y antes utilizar 'break' nunca se ejecutaba. Aъn asн, si, no servнa para nada.