morir al caer de la torre
#5

la torre es un piso plano ? si es asн puedes crear un timer que compruebe la coordenada z, un timer por todos los players no 1 timer por persona, aquн tienes un cуdigo
pawn Код:
public OnGameModeInit()
{
    SetTimer("TimerTorre",1000,true);
    return 1;
}

public OnPlayerCommandText(playerid,cmdtext[])
{
    if(strcmp(cmdtext,"/torre",true) == 0)
    {
        new Float: x, Float: y, Float: z,  i, vw;
        GetPlayerPos(playerid, x, y, z);
        vw = GetPlayerVirtualWorld(playerid);
        i = GetPlayerInterior(playerid);
        SetPVarFloat(playerid, "LastPosX", x);
        SetPVarFloat(playerid, "LastPosY", y);
        SetPVarFloat(playerid, "LastPosZ", z);
        SetPVarInt(playerid, "LastInt", i);
        SetPVarInt(playerid, "LastVW", vw);
        EnTorre[playerid] = 1;
        SetPlayerPos(playerid,coordx,coordy,coordz);// Cambiar las coordenadas por las de la torre
        return 1;
    }
    if(strcmp(cmdtext,"/salirtorre",true) == 0)
    {
        SetPlayerPos(playerid, GetPVarFloat(playerid, "LastPosX"), GetPVarFloat(playerid, "LastPosY"),                      GetPVarFloat(playerid, "LastPosZ"));
        SetPlayerVirtualWorld(playerid, GetPVarInt(playerid, "LastVW"));
        SetPlayerInterior(playerid, GetPVarInt(playerid, "LastInt"));
        return 1;
    }
    return 0;
}

forward TimerTorre();
public TimerTorre()
{
    new Float:pos[3];
    for(new i,d=GetMaxPlayers();i<d;i++)
    {
        if(IsPlayerConnected(i) && EnTorre[i])
        {
            GetPlayerPos(i,pos[0],pos[1],pos[2]);
            if( pos[2] < PisoTorre)// Cambia "PisoTorre" por la coordenada z del piso de la torre
            {
                SetVehiclePos(GetPlayerVehicleID(i),coordx,coordy,coordz);// cambia el texto por las coordenadas de la torre

            }                    
 
        }
    }

}
Es un codigo "base" que le faltan cosas a tu gusto, bueno no tan base por que te lo di todo, aclaro que copie el codigo que dejo junkbuster para no escribirlo de nuevo, ademas que lo hiso muy bien
Reply


Messages In This Thread
morir al caer de la torre - by chucho - 15.02.2012, 04:16
Respuesta: al caer morir - by junkbuster - 15.02.2012, 04:19
Respuesta: morir al caer de la torre - by chucho - 15.02.2012, 04:26
Respuesta: morir al caer de la torre - by junkbuster - 15.02.2012, 04:41
Respuesta: morir al caer de la torre - by Jovanny - 15.02.2012, 20:13

Forum Jump:


Users browsing this thread: 3 Guest(s)