SA-MP Forums Archive
Ayuda - 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 (/showthread.php?tid=557398)



Ayuda - TyreseKowalski - 13.01.2015

Hola a todos espero esten bien quisiera que me ayudaran a poner esto en mi server y es lo siguiente.
Cuando un sujeto esta con cargos y es abatido el puede pedir /servicios y llamar a los mйdicos quisiera que no pudiera cuando esta muerto con cargos y le salga No puedes hacer esto en este momento o algo asi.

Dejo comando
pawn Код:
// 6 sec tick rate
timer EMSUpdate[6000](){
foreach(Player, i){
    if(GetPVarType(i, "Injured")){
        if(GetPVarInt(i, "EMSAttempt") != 0){
            new Float:health;
            GetPlayerHealth(i,health);
            if(GetPVarInt(i, "EMSAttempt") == -1)
            {
                if(!IsPlayerInRangeOfPoint(i, 3.0, GetPVarFloat(i,"MedicX"), GetPVarFloat(i,"MedicY"), GetPVarFloat(i,"MedicZ")))
                {
                    Streamer_UpdateEx(i, GetPVarFloat(i,"MedicX"), GetPVarFloat(i,"MedicY"), GetPVarFloat(i,"MedicZ"));
                    SetPlayerPos(i, GetPVarFloat(i,"MedicX"), GetPVarFloat(i,"MedicY"), GetPVarFloat(i,"MedicZ"));
                    SetPlayerVirtualWorld(i, GetPVarInt(i,"MedicVW"));
                    SetPlayerInterior(i, GetPVarInt(i,"MedicInt"));
                }
                SetHP(i, health-5);
                ApplyAnimation(i, "CRACK", "crckidle1",4.0,0,1,1,1,-1);
                GameTextForPlayer(i, "~y~Estas herido~n~~w~/aceptar muerte o /servicios", 5000, 3);
            }
            if(GetPVarInt(i, "EMSAttempt") == 1)
            {
                if(!IsPlayerInRangeOfPoint(i, 3.0, GetPVarFloat(i,"MedicX"), GetPVarFloat(i,"MedicY"), GetPVarFloat(i,"MedicZ")))
                {
                    Streamer_UpdateEx(i, GetPVarFloat(i,"MedicX"), GetPVarFloat(i,"MedicY"), GetPVarFloat(i,"MedicZ"));
                    SetPlayerPos(i, GetPVarFloat(i,"MedicX"), GetPVarFloat(i,"MedicY"), GetPVarFloat(i,"MedicZ"));
                    SetPlayerVirtualWorld(i, GetPVarInt(i,"MedicVW"));
                    SetPlayerInterior(i, GetPVarInt(i,"MedicInt"));
                }
                SetHP(i, health-5);
                ApplyAnimation(i, "CRACK", "crckidle1",4.0,0,1,1,1,-1);
                GameTextForPlayer(i, "~r~Herido~n~~w~Espera que SAMD llege...", 5000, 3);
            }
            if(GetPVarInt(i, "EMSAttempt") == 8)
            {
                if(!IsPlayerInRangeOfPoint(i, 3.0, GetPVarFloat(i,"MedicX"), GetPVarFloat(i,"MedicY"), GetPVarFloat(i,"MedicZ")))
                {
                    Streamer_UpdateEx(i, GetPVarFloat(i,"MedicX"), GetPVarFloat(i,"MedicY"), GetPVarFloat(i,"MedicZ"));
                    SetPlayerPos(i, GetPVarFloat(i,"MedicX"), GetPVarFloat(i,"MedicY"), GetPVarFloat(i,"MedicZ"));
                    SetPlayerVirtualWorld(i, GetPVarInt(i,"MedicVW"));
                    SetPlayerInterior(i, GetPVarInt(i,"MedicInt"));
                }
                SetHP(i, health-5);
                ApplyAnimation(i, "CRACK", "crckidle1",4.0,0,1,1,1,-1);
                GameTextForPlayer(i, "~r~Herido~n~~w~Espera que SAMD llege...", 5000, 3);
            }
            if(GetPVarInt(i, "EMSAttempt") == 2)
            {
                if(!IsPlayerInRangeOfPoint(i, 3.0, GetPVarFloat(i,"MedicX"), GetPVarFloat(i,"MedicY"), GetPVarFloat(i,"MedicZ")))
                {
                    Streamer_UpdateEx(i, GetPVarFloat(i,"MedicX"), GetPVarFloat(i,"MedicY"), GetPVarFloat(i,"MedicZ"));
                    SetPlayerPos(i, GetPVarFloat(i,"MedicX"), GetPVarFloat(i,"MedicY"), GetPVarFloat(i,"MedicZ"));
                    SetPlayerVirtualWorld(i, GetPVarInt(i,"MedicVW"));
                    SetPlayerInterior(i, GetPVarInt(i,"MedicInt"));
                }
Gracias por leer, creo que es ese el comando si no es asi avнsenme porfavor


Respuesta: Ayuda - jotajeda - 13.01.2015

Usas una condicional simplemente, y la hubicas donde quieras, en el comando, o en ese timer que muestras.
pawn Код:
if(Var_Cargos[playerid]) return SendClientMessage(playerid,color1 , "No puedes usar esto si tienes cargos.");
Si necesitas un pedido a medida usa este link: https://sampforum.blast.hk/showthread.php?tid=518459


Re: Ayuda - TyreseKowalski - 14.01.2015

Quedo asi el comando amigo

pawn Код:
// 6 sec tick rate
timer EMSUpdate[6000](){
foreach(Player, i){
    if(GetPVarType(i, "Injured")){
        if(GetPVarInt(i, "EMSAttempt") != 0){
            new Float:health;
            GetPlayerHealth(i,health);
            if(GetPVarInt(i, "EMSAttempt") == -1)
            {
                if(!IsPlayerInRangeOfPoint(i, 3.0, GetPVarFloat(i,"MedicX"), GetPVarFloat(i,"MedicY"), GetPVarFloat(i,"MedicZ")))
                {
                    Streamer_UpdateEx(i, GetPVarFloat(i,"MedicX"), GetPVarFloat(i,"MedicY"), GetPVarFloat(i,"MedicZ"));
                    SetPlayerPos(i, GetPVarFloat(i,"MedicX"), GetPVarFloat(i,"MedicY"), GetPVarFloat(i,"MedicZ"));
                    SetPlayerVirtualWorld(i, GetPVarInt(i,"MedicVW"));
                    SetPlayerInterior(i, GetPVarInt(i,"MedicInt"));
                }
                SetHP(i, health-5);
                ApplyAnimation(i, "CRACK", "crckidle1",4.0,0,1,1,1,-1);
                GameTextForPlayer(i, "~y~Estas herido~n~~w~/aceptar muerte o /servicios", 5000, 3);
            }
            if(Var_Cargos[playerid]) return SendClientMessage(playerid,color1 , "No puedes usar esto si tienes cargos.");
            }
            if(GetPVarInt(i, "EMSAttempt") == 1)
            {
                if(!IsPlayerInRangeOfPoint(i, 3.0, GetPVarFloat(i,"MedicX"), GetPVarFloat(i,"MedicY"), GetPVarFloat(i,"MedicZ")))
                {
                    Streamer_UpdateEx(i, GetPVarFloat(i,"MedicX"), GetPVarFloat(i,"MedicY"), GetPVarFloat(i,"MedicZ"));
                    SetPlayerPos(i, GetPVarFloat(i,"MedicX"), GetPVarFloat(i,"MedicY"), GetPVarFloat(i,"MedicZ"));
                    SetPlayerVirtualWorld(i, GetPVarInt(i,"MedicVW"));
                    SetPlayerInterior(i, GetPVarInt(i,"MedicInt"));
                }
                SetHP(i, health-5);
                ApplyAnimation(i, "CRACK", "crckidle1",4.0,0,1,1,1,-1);
                GameTextForPlayer(i, "~r~Herido~n~~w~Espera que SAMD llege...", 5000, 3);
            }
            if(GetPVarInt(i, "EMSAttempt") == 8)
            {
                if(!IsPlayerInRangeOfPoint(i, 3.0, GetPVarFloat(i,"MedicX"), GetPVarFloat(i,"MedicY"), GetPVarFloat(i,"MedicZ")))
                {
                    Streamer_UpdateEx(i, GetPVarFloat(i,"MedicX"), GetPVarFloat(i,"MedicY"), GetPVarFloat(i,"MedicZ"));
                    SetPlayerPos(i, GetPVarFloat(i,"MedicX"), GetPVarFloat(i,"MedicY"), GetPVarFloat(i,"MedicZ"));
                    SetPlayerVirtualWorld(i, GetPVarInt(i,"MedicVW"));
                    SetPlayerInterior(i, GetPVarInt(i,"MedicInt"));
                }
                SetHP(i, health-5);
                ApplyAnimation(i, "CRACK", "crckidle1",4.0,0,1,1,1,-1);
                GameTextForPlayer(i, "~r~Herido~n~~w~Espera que SAMD llege...", 5000, 3);
            }
            if(GetPVarInt(i, "EMSAttempt") == 2)
            {
                if(!IsPlayerInRangeOfPoint(i, 3.0, GetPVarFloat(i,"MedicX"), GetPVarFloat(i,"MedicY"), GetPVarFloat(i,"MedicZ")))
                {
                    Streamer_UpdateEx(i, GetPVarFloat(i,"MedicX"), GetPVarFloat(i,"MedicY"), GetPVarFloat(i,"MedicZ"));
                    SetPlayerPos(i, GetPVarFloat(i,"MedicX"), GetPVarFloat(i,"MedicY"), GetPVarFloat(i,"MedicZ"));
                    SetPlayerVirtualWorld(i, GetPVarInt(i,"MedicVW"));
                    SetPlayerInterior(i, GetPVarInt(i,"MedicInt"));
                }
                GameTextForPlayer(i, "~g~Rescatado~n~~w~En espera de atencion medica...", 5000, 3);
            }
            if(GetPVarInt(i, "EMSAttempt") == 3){
                if(IsPlayerInAnyVehicle(i)){
                    new ambmodel = GetPlayerVehicleID(i);
                    if(GetVehicleModel(ambmodel) == 416){
                        GameTextForPlayer(i, "~g~Rescatado~n~~w~Espera que SAMD te lleve al hospital...", 5000, 3);
                    }
                    else{
                        SendClientMessageEx(i, COLOR_WHITE, "Perdiste el conocimiento y se te translado inmediatamente al hospital.");
                        KillEMSQueue(i);
                        SetPVarInt(i, "Hospital", 1);
                        SpawnPlayer(i);
                    }
                }
                else{
                    SendClientMessageEx(i, COLOR_WHITE, "Perdiste el conocimiento y se te translado inmediatamente al hospital.");
                    KillEMSQueue(i);
                    SetPVarInt(i, "Hospital", 1);
                    SpawnPlayer(i);
                }
            }
            if(health <= 10)
            {
                SendClientMessageEx(i, COLOR_WHITE, "Perdiste el conocimiento y se te translado inmediatamente al hospital.");
                KillEMSQueue(i);
                SetPVarInt(i, "Hospital", 1);
                SetHP(i, 50);
                SpawnPlayer(i);
            }

        }

    }
}
}
me salta error

pawn Код:
G:\ArgonZone\gamemodes\GM.pwn(26942) : error 008: must be a constant expression; assumed zero
G:\ArgonZone\gamemodes\GM.pwn(26950) : warning 217: loose indentation
G:\ArgonZone\gamemodes\GM.pwn(28817) : warning 217: loose indentation
G:\ArgonZone\gamemodes\GM.pwn(28855) : warning 217: loose indentation
G:\ArgonZone\gamemodes\GM.pwn(44233) : warning 217: loose indentation
G:\ArgonZone\gamemodes\GM.pwn(47383) : error 017: undefined symbol "Var_Cargos"
G:\ArgonZone\gamemodes\GM.pwn(47383) : error 017: undefined symbol "playerid"
G:\ArgonZone\gamemodes\GM.pwn(47383) : error 029: invalid expression, assumed zero
G:\ArgonZone\gamemodes\GM.pwn(47383) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


5 Errors.



Respuesta: Re: Ayuda - jotajeda - 14.01.2015

Quote:
Originally Posted by TyreseKowalski
Посмотреть сообщение
Quedo asi el comando amigo

pawn Код:
// 6 sec tick rate
timer EMSUpdate[6000](){
foreach(Player, i){
    if(GetPVarType(i, "Injured")){
        if(GetPVarInt(i, "EMSAttempt") != 0){
            new Float:health;
            GetPlayerHealth(i,health);
            if(GetPVarInt(i, "EMSAttempt") == -1)
            {
                if(!IsPlayerInRangeOfPoint(i, 3.0, GetPVarFloat(i,"MedicX"), GetPVarFloat(i,"MedicY"), GetPVarFloat(i,"MedicZ")))
                {
                    Streamer_UpdateEx(i, GetPVarFloat(i,"MedicX"), GetPVarFloat(i,"MedicY"), GetPVarFloat(i,"MedicZ"));
                    SetPlayerPos(i, GetPVarFloat(i,"MedicX"), GetPVarFloat(i,"MedicY"), GetPVarFloat(i,"MedicZ"));
                    SetPlayerVirtualWorld(i, GetPVarInt(i,"MedicVW"));
                    SetPlayerInterior(i, GetPVarInt(i,"MedicInt"));
                }
                SetHP(i, health-5);
                ApplyAnimation(i, "CRACK", "crckidle1",4.0,0,1,1,1,-1);
                GameTextForPlayer(i, "~y~Estas herido~n~~w~/aceptar muerte o /servicios", 5000, 3);
            }
            if(Var_Cargos[playerid]) return SendClientMessage(playerid,color1 , "No puedes usar esto si tienes cargos.");
            }
            if(GetPVarInt(i, "EMSAttempt") == 1)
            {
                if(!IsPlayerInRangeOfPoint(i, 3.0, GetPVarFloat(i,"MedicX"), GetPVarFloat(i,"MedicY"), GetPVarFloat(i,"MedicZ")))
                {
                    Streamer_UpdateEx(i, GetPVarFloat(i,"MedicX"), GetPVarFloat(i,"MedicY"), GetPVarFloat(i,"MedicZ"));
                    SetPlayerPos(i, GetPVarFloat(i,"MedicX"), GetPVarFloat(i,"MedicY"), GetPVarFloat(i,"MedicZ"));
                    SetPlayerVirtualWorld(i, GetPVarInt(i,"MedicVW"));
                    SetPlayerInterior(i, GetPVarInt(i,"MedicInt"));
                }
                SetHP(i, health-5);
                ApplyAnimation(i, "CRACK", "crckidle1",4.0,0,1,1,1,-1);
                GameTextForPlayer(i, "~r~Herido~n~~w~Espera que SAMD llege...", 5000, 3);
            }
            if(GetPVarInt(i, "EMSAttempt") == 8)
            {
                if(!IsPlayerInRangeOfPoint(i, 3.0, GetPVarFloat(i,"MedicX"), GetPVarFloat(i,"MedicY"), GetPVarFloat(i,"MedicZ")))
                {
                    Streamer_UpdateEx(i, GetPVarFloat(i,"MedicX"), GetPVarFloat(i,"MedicY"), GetPVarFloat(i,"MedicZ"));
                    SetPlayerPos(i, GetPVarFloat(i,"MedicX"), GetPVarFloat(i,"MedicY"), GetPVarFloat(i,"MedicZ"));
                    SetPlayerVirtualWorld(i, GetPVarInt(i,"MedicVW"));
                    SetPlayerInterior(i, GetPVarInt(i,"MedicInt"));
                }
                SetHP(i, health-5);
                ApplyAnimation(i, "CRACK", "crckidle1",4.0,0,1,1,1,-1);
                GameTextForPlayer(i, "~r~Herido~n~~w~Espera que SAMD llege...", 5000, 3);
            }
            if(GetPVarInt(i, "EMSAttempt") == 2)
            {
                if(!IsPlayerInRangeOfPoint(i, 3.0, GetPVarFloat(i,"MedicX"), GetPVarFloat(i,"MedicY"), GetPVarFloat(i,"MedicZ")))
                {
                    Streamer_UpdateEx(i, GetPVarFloat(i,"MedicX"), GetPVarFloat(i,"MedicY"), GetPVarFloat(i,"MedicZ"));
                    SetPlayerPos(i, GetPVarFloat(i,"MedicX"), GetPVarFloat(i,"MedicY"), GetPVarFloat(i,"MedicZ"));
                    SetPlayerVirtualWorld(i, GetPVarInt(i,"MedicVW"));
                    SetPlayerInterior(i, GetPVarInt(i,"MedicInt"));
                }
                GameTextForPlayer(i, "~g~Rescatado~n~~w~En espera de atencion medica...", 5000, 3);
            }
            if(GetPVarInt(i, "EMSAttempt") == 3){
                if(IsPlayerInAnyVehicle(i)){
                    new ambmodel = GetPlayerVehicleID(i);
                    if(GetVehicleModel(ambmodel) == 416){
                        GameTextForPlayer(i, "~g~Rescatado~n~~w~Espera que SAMD te lleve al hospital...", 5000, 3);
                    }
                    else{
                        SendClientMessageEx(i, COLOR_WHITE, "Perdiste el conocimiento y se te translado inmediatamente al hospital.");
                        KillEMSQueue(i);
                        SetPVarInt(i, "Hospital", 1);
                        SpawnPlayer(i);
                    }
                }
                else{
                    SendClientMessageEx(i, COLOR_WHITE, "Perdiste el conocimiento y se te translado inmediatamente al hospital.");
                    KillEMSQueue(i);
                    SetPVarInt(i, "Hospital", 1);
                    SpawnPlayer(i);
                }
            }
            if(health <= 10)
            {
                SendClientMessageEx(i, COLOR_WHITE, "Perdiste el conocimiento y se te translado inmediatamente al hospital.");
                KillEMSQueue(i);
                SetPVarInt(i, "Hospital", 1);
                SetHP(i, 50);
                SpawnPlayer(i);
            }

        }

    }
}
}
me salta error

pawn Код:
G:\ArgonZone\gamemodes\GM.pwn(26942) : error 008: must be a constant expression; assumed zero
G:\ArgonZone\gamemodes\GM.pwn(26950) : warning 217: loose indentation
G:\ArgonZone\gamemodes\GM.pwn(28817) : warning 217: loose indentation
G:\ArgonZone\gamemodes\GM.pwn(28855) : warning 217: loose indentation
G:\ArgonZone\gamemodes\GM.pwn(44233) : warning 217: loose indentation
G:\ArgonZone\gamemodes\GM.pwn(47383) : error 017: undefined symbol "Var_Cargos"
G:\ArgonZone\gamemodes\GM.pwn(47383) : error 017: undefined symbol "playerid"
G:\ArgonZone\gamemodes\GM.pwn(47383) : error 029: invalid expression, assumed zero
G:\ArgonZone\gamemodes\GM.pwn(47383) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


5 Errors.
lo que te di era un ejemplo, no era lo que tenias que copiar y pegar.


Re: Ayuda - TyreseKowalski - 14.01.2015

daaa ayudame porfavor ya llevo rato poniendo cosas e intentando comandos y nada y aparece tu respuesta y tampoco es mmmm.


Respuesta: Re: Ayuda - jotajeda - 14.01.2015

Quote:
Originally Posted by TyreseKowalski
Посмотреть сообщение
daaa ayudame porfavor ya llevo rato poniendo cosas e intentando comandos y nada y aparece tu respuesta y tampoco es mmmm.
Comiensa con cosas basicas para que comprendas, siempre consulta con la wikisamp.


Re: Ayuda - TyreseKowalski - 14.01.2015

Men estoy aprendiendo de apoco ya se que es new else for if set apply pero necesito siempre ayudita para seguir comprendiendo las cosas porfa tu me puedes ayudar


Respuesta: Ayuda - Goncho28 - 14.01.2015

Muchos te ayudarнan si no te copiases de FZ


Re: Ayuda - TyreseKowalski - 14.01.2015

Estoy tratando de no copiarme a fz tengo muchas ideas solo que estube 2 aсos en ese server y me gustaron muchas letras de las que tiene solo letras men no nada de mapeos trabajos npc nada solo letras amigo