Jump to content
  • 0

Water touch [SOLVED]


Alexandru Alex

Question

    if(IsPlayerUsingSwimAnim(playerid))

return SetPlayerPos(playerid, 466.9015,-2175.7107,43.5915);


Nu inteleg, nu ma teleporteaza in acea locatie cand intru in apa.. Care i faza?
Multumesc anticipat

Edited by Alexandru Alex
Link to comment
Share on other sites

9 answers to this question

Recommended Posts

  • 0

pentru ca probabil tu ai ceva gresit, 

stock 
    IsPlayerInArea(playerid, Float:MinX, Float:MinY, Float:MaxX, Float:MaxY)
    {
        new Float:X, Float:Y, Float:Z;
        GetPlayerPos(playerid, X, Y, Z);
        if(X >= MinX && X <= MaxX && Y >= MinY && Y <= MaxY) {
            return 1;
        }
        return 0;
    }
 
stock 
    IsPlayerInWaterLocation(playerid)
    {
        new Float:null[2], Float:MaxZ;
        GetPlayerPos(playerid, null[0], null[1], MaxZ);
        /* Las Venturas */
        if(IsPlayerInArea(playerid, 2044.6, 1206.358, 2192.984, 1376.552) && MaxZ < 0xA)
            return 1;
        else if(IsPlayerInArea(playerid, 2048.504, 1063.239, 2185.174, 1202.49) && MaxZ < 0xA)
            return 1;
        else if(IsPlayerInArea(playerid, 2204.698, 1426.837, 2204.698, 1430.705) && MaxZ < 0xA)
            return 1;
        else if(IsPlayerInArea(playerid, 2032.885, 1852.325, 2114.887, 1991.575) && MaxZ < 0xC)
            return 1;
        else if(IsPlayerInArea(playerid, 2517.086, 2316.493, 2606.897, 2420.93) && MaxZ < 0x16)
            return 1;
        else if(IsPlayerInArea(playerid, 2554.5996, 1548.6178, 2507.7683, 1588.9154) && MaxZ < 0xF)
            return 1;
        /* San Fierro */
        else if(IsPlayerInArea(playerid, -2043.628, -980.9415, -1973.561, -724.0283) && MaxZ < 0x20)
            return 1;
        else if(IsPlayerInArea(playerid, -2753.912, -522.3632, -2665.071, -380.3444) && MaxZ < 0x05)
            return 1;
        /* Los Santos */
        else if(IsPlayerInArea(playerid, 1219.864, -2435.881, 1292.118, -2325.344) && MaxZ < 0xF)
            return 1;
        else if(IsPlayerInArea(playerid, 1923.388, -1223.924, 2010.854, -1168.656) && MaxZ < 0x16)
            return 1;
        else if(IsPlayerInArea(playerid, 1269.301, -837.0452, 1314.935, -781.7769) && MaxZ < 0x5A)
            return 1;
        else if(IsPlayerInArea(playerid, 1087.3953, -682.6734, 1102.3138, -663.0043) && MaxZ < 0x71)
            return 1;
        else if(IsPlayerInArea(playerid, 1268.6118, -784.2910, 1291.8774, -764.6104) && MaxZ < 0x43D)
            return 1;
        /* Bounds */
        else if(MaxZ < 0xF)
            return 1;
        return 0;
    }
    
stock 
    IsPlayerUsingSwimAnim(playerid)
    {
        if(IsPlayerInAnyVehicle(playerid) || GetPlayerState(playerid) != PLAYER_STATE_ONFOOT)
            return 0;
        new 
            animlib[32],
            animname[32];
        GetAnimationName(GetPlayerAnimationIndex(playerid),animlib,32,animname,32);
        if(!strcmp(animlib, "SWIM", true) && !strcmp(animname, "SWIM_GLIDE", true))
            return 1;
        else if(!strcmp(animlib, "SWIM", true) && !strcmp(animname, "SWIM_BREAST", true))
            return 1;
        else if(!strcmp(animlib, "SWIM", true) && !strcmp(animname, "SWIM_CRAWL", true))
            return 1;
        else if(!strcmp(animlib, "SWIM", true) && !strcmp(animname, "SWIM_DIVE_UNDER", true))
            return 1;
        else if(!strcmp(animlib, "SWIM", true) && !strcmp(animname, "SWIM_DIVE_GLIDE", true))
            return 1;
        else if(!strcmp(animlib, "SWIM", true) && !strcmp(animname, "SWIM_UNDER", true))
            return 1;
        else if(!strcmp(animlib, "SWIM", true) && !strcmp(animname, "SWIM_TREAD", true))
            return 1;
        return 0;
    }
    
stock
    IsPlayerInWater(playerid)
    {
        if(IsPlayerInWaterLocation(playerid) && IsPlayerUsingSwimAnim(playerid))
            return 1;
        return 0;
    }

te vei folosi de isplayerinwater

Link to comment
Share on other sites

  • 0
41 minutes ago, hanako said:

pentru ca probabil tu ai ceva gresit, 

stock 
    IsPlayerInArea(playerid, Float:MinX, Float:MinY, Float:MaxX, Float:MaxY)
    {
        new Float:X, Float:Y, Float:Z;
        GetPlayerPos(playerid, X, Y, Z);
        if(X >= MinX && X <= MaxX && Y >= MinY && Y <= MaxY) {
            return 1;
        }
        return 0;
    }
 
stock 
    IsPlayerInWaterLocation(playerid)
    {
        new Float:null[2], Float:MaxZ;
        GetPlayerPos(playerid, null[0], null[1], MaxZ);
        /* Las Venturas */
        if(IsPlayerInArea(playerid, 2044.6, 1206.358, 2192.984, 1376.552) && MaxZ < 0xA)
            return 1;
        else if(IsPlayerInArea(playerid, 2048.504, 1063.239, 2185.174, 1202.49) && MaxZ < 0xA)
            return 1;
        else if(IsPlayerInArea(playerid, 2204.698, 1426.837, 2204.698, 1430.705) && MaxZ < 0xA)
            return 1;
        else if(IsPlayerInArea(playerid, 2032.885, 1852.325, 2114.887, 1991.575) && MaxZ < 0xC)
            return 1;
        else if(IsPlayerInArea(playerid, 2517.086, 2316.493, 2606.897, 2420.93) && MaxZ < 0x16)
            return 1;
        else if(IsPlayerInArea(playerid, 2554.5996, 1548.6178, 2507.7683, 1588.9154) && MaxZ < 0xF)
            return 1;
        /* San Fierro */
        else if(IsPlayerInArea(playerid, -2043.628, -980.9415, -1973.561, -724.0283) && MaxZ < 0x20)
            return 1;
        else if(IsPlayerInArea(playerid, -2753.912, -522.3632, -2665.071, -380.3444) && MaxZ < 0x05)
            return 1;
        /* Los Santos */
        else if(IsPlayerInArea(playerid, 1219.864, -2435.881, 1292.118, -2325.344) && MaxZ < 0xF)
            return 1;
        else if(IsPlayerInArea(playerid, 1923.388, -1223.924, 2010.854, -1168.656) && MaxZ < 0x16)
            return 1;
        else if(IsPlayerInArea(playerid, 1269.301, -837.0452, 1314.935, -781.7769) && MaxZ < 0x5A)
            return 1;
        else if(IsPlayerInArea(playerid, 1087.3953, -682.6734, 1102.3138, -663.0043) && MaxZ < 0x71)
            return 1;
        else if(IsPlayerInArea(playerid, 1268.6118, -784.2910, 1291.8774, -764.6104) && MaxZ < 0x43D)
            return 1;
        /* Bounds */
        else if(MaxZ < 0xF)
            return 1;
        return 0;
    }
    
stock 
    IsPlayerUsingSwimAnim(playerid)
    {
        if(IsPlayerInAnyVehicle(playerid) || GetPlayerState(playerid) != PLAYER_STATE_ONFOOT)
            return 0;
        new 
            animlib[32],
            animname[32];
        GetAnimationName(GetPlayerAnimationIndex(playerid),animlib,32,animname,32);
        if(!strcmp(animlib, "SWIM", true) && !strcmp(animname, "SWIM_GLIDE", true))
            return 1;
        else if(!strcmp(animlib, "SWIM", true) && !strcmp(animname, "SWIM_BREAST", true))
            return 1;
        else if(!strcmp(animlib, "SWIM", true) && !strcmp(animname, "SWIM_CRAWL", true))
            return 1;
        else if(!strcmp(animlib, "SWIM", true) && !strcmp(animname, "SWIM_DIVE_UNDER", true))
            return 1;
        else if(!strcmp(animlib, "SWIM", true) && !strcmp(animname, "SWIM_DIVE_GLIDE", true))
            return 1;
        else if(!strcmp(animlib, "SWIM", true) && !strcmp(animname, "SWIM_UNDER", true))
            return 1;
        else if(!strcmp(animlib, "SWIM", true) && !strcmp(animname, "SWIM_TREAD", true))
            return 1;
        return 0;
    }
    
stock
    IsPlayerInWater(playerid)
    {
        if(IsPlayerInWaterLocation(playerid) && IsPlayerUsingSwimAnim(playerid))
            return 1;
        return 0;
    }

te vei folosi de isplayerinwater

degeaba..

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.