SA-MP Forums Archive
Problem with a loop - 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: Problem with a loop (/showthread.php?tid=496721)



Problem with a loop - redneckvideogamer - 23.02.2014

Hey everyone, today i tried to make a loop to hide a textdraw, but it goes after a check for a variable, the thing is that it starts the "CustomizePlayer" function but it doesn't hide the textdraw. I know it will be an easy fix, but idk why I just can't see it.

Код:
public OnPlayerSpawn(playerid)
{
    StopAudioStreamForPlayer(playerid);
    if(pInfo[playerid][isCustomized] == false)
    {
        StartPlayerCustomization(playerid);
    }
    else if(pInfo[playerid][isCustomized])
    {
        //SetPlayerPos(playerid, Shelter_Spawn);
        SendClientMessage(playerid, -1, "Modificado");
        return 1;
    }
    for(new j; j < MAX_HOME_TDS; j++) PlayerTextDrawHide(playerid, homescr[j][playerid]);//This doesn't load!
    return 1;
}
Help!


Re: Problem with a loop - MP2 - 23.02.2014

Add debug prints.


Re: Problem with a loop - redneckvideogamer - 23.02.2014

Код:
public OnPlayerSpawn(playerid)
{
    StopAudioStreamForPlayer(playerid);
    print("Did this A");
    if(pInfo[playerid][isCustomized] == false)
    {
        StartPlayerCustomization(playerid);
        print("Did this B");
    }
    else if(pInfo[playerid][isCustomized])
    {
        //SetPlayerPos(playerid, Shelter_Spawn);
        SendClientMessage(playerid, -1, "Modificado");
        print("Did this C");
        return 1;
    }
    for(new j; j < MAX_HOME_TDS; j++) PlayerTextDrawHide(playerid, homescr[j][playerid]); print("Did this D");
    return 1;
}
Now it only prints "A", but it stills executes the "StartPlayerCustomization", without printing it though.


Re: Problem with a loop - MP2 - 23.02.2014

Was "Did this B" printed? If not, add a print BEFORE StartPlayerCustomization also. If it prints before but not after, something in StartPlayerCustomization is causing a crash.