SA-MP Forums Archive
[HELP]Spec, if you finish . - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [HELP]Spec, if you finish . (/showthread.php?tid=261893)



[HELP]Spec, if you finish . - Gertin - 15.06.2011

Hey i want to make that , when i finish (race) , then i go specing , and i can use Space to spec next and so else i make ( my friend ) smthing , but its not working . Can you say, where is my fail and can you fix it ?

pawn Код:
SetPVarInt(playerid,"Spectator",1);
                TogglePlayerSpectating(playerid, 1);
                TextDrawShowForPlayer(playerid, SpecInfo);
                TextDrawShowForPlayer(playerid, SpaceInfo);
                for(new i;i<MAX_PLAYERS;i++)
                {
                    if(IsPlayerConnected(i))
                    {
                        specing[playerid] = i;
                        PlayerSpectatePlayer(playerid, i);
                        spectatting[playerid] = 1;
                        return 1;
                    }
                    if(i == MAX_PLAYERS) i=0;
                }
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys == KEY_SPRINT)
    {
        if(spectatting[playerid] == 1)
        {
            for(new i;specing[playerid]<MAX_PLAYERS;i++)
            {
                if(IsPlayerConnected(i))
                {
                    specing[playerid] = i;
                    PlayerSpectatePlayer(playerid, i);
                    spectatting[playerid] = 1;
                    return 1;
                }
                if(i == MAX_PLAYERS) i=0;
            }
            return 1;
        }
        return 1;
    }
    return 1;
}