SA-MP Forums Archive
Moving Gate[+rep] - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Moving Gate[+rep] (/showthread.php?tid=476582)



Moving Gate[+rep] - KickInTheMick - 19.11.2013

I tried to create moving gate for clan I used strfind but it doesn't work I will ask you to give me example so I will be able to do it myself. This is my first time I used strfind.


Re: Moving Gate[+rep] - Jankingston - 19.11.2013

although u can use This


Re: Moving Gate[+rep] - Biesmen - 19.11.2013

1. Which/what moving gate?
2. Why are you using strfind?
3. On what are you using strfind?
4. Your question is very, very inaccurate.. "it doesn't work".. What doesn't work? strfind is unable to find cows in your gamemode?
5. You've got to understand you have to post your code or else no one is able to help you out.
6. Don't ever make a thread with the title "+rep" anymore. You look like a desperate annoying little child.


Re: Moving Gate[+rep] - KickInTheMick - 19.11.2013

pawn Код:
new Gate;
new GateStatus;

public OnGameModeInit()
{
    Gate = CreateObject(980, 1067.08704, 1359.38843, 12.29745,   0.00000, 0.00000, 0.00000);
    return 1;
}

CMD:gate(playerid, params[])
{
    new playername[24];
    if( strfind( playername, "TAG", true) == -1 )
    {
        SendClientMessage( playerid, 0xFFFFFFFF, "...................");
        return 1;
    }
    if(IsPlayerInRangeOfPoint(playerid, 8.0, 1067.08704, 1359.38843, 12.29745))
    {
        if(GateStatus == 0)
        {
            MoveObject(Gate, 1067.08704, 1359.38843, 6.80000, 2.00);
            GateStatus = 1;
        }
        else
        {
            MoveObject(Gate, 1067.08704, 1359.38843, 12.29745, 2.00);
            GateStatus = 0;
        }
    }
    return 1;
}
Without strfind it works perfect


Re: Moving Gate[+rep] - Biesmen - 19.11.2013

pawn Код:
new playername[24];
    if( strfind( playername, "TAG", true) == -1 )
    {
        SendClientMessage( playerid, 0xFFFFFFFF, "...................");
        return 1;
    }
- You defined an array called "playername". However, you are not giving the array content. You're not getting someone's username right now.

- Why are you using "== -1"? It returns -1 if the text "TAG" has not been found. It returns a different value if it is found. Which means, you should definitely replace "== -1" with "!= -1". Unless you want to close the callback for users who do not have "TAG" in their name. If this is the case, then ignore this point.

Quote:
Originally Posted by KickInTheMick
Посмотреть сообщение
Without strfind it works perfect
Of course, it returns "-1" which means, "TAG" has not been found in the array with no content.

At this moment strfind is looking for the text "TAG" in the array playername. But playername does not have content, which means the array is defined like this: "".


Re: Moving Gate[+rep] - KickInTheMick - 19.11.2013

Fixed. Thanks Biesmen +rep