Moving Gate[+rep]
#1

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.
Reply
#2

although u can use This
Reply
#3

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.
Reply
#4

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
Reply
#5

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: "".
Reply
#6

Fixed. Thanks Biesmen +rep
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)