SA-MP Forums Archive
What's wrong with this script? - 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: What's wrong with this script? (/showthread.php?tid=131918)



What's wrong with this script? - SaW_[VrTx] - 05.03.2010

pawn Код:
forward step1(playerid);
pawn Код:
public OnPlayerSpawn(playerid)
{
    SetPlayerInterior(playerid,0);
// Komandas
    if(gTeam[playerid] == komanda1) {
    SetPlayerColor(playerid,DZELTANS); // Pirma komanda - Sarkana
        }
    else if(gTeam[playerid] == komanda2) {
    SetPlayerColor(playerid,SARKANS); // Otra komanda - Zila
        }
// Pamaciba
    {
    SetPlayerPos(playerid,3759.3091,-1411.2380,4.2778);
    SetPlayerFacingAngle(playerid, 233.0);
    SetPlayerCameraPos(playerid,3714.0308,-1372.3802,24.3491);
    SetPlayerCameraLookAt(playerid,3759.3091,-1411.2380,4.2778);
    SendClientMessage(playerid,SARKANS,"-------------------");
    SendClientMessage(playerid,DZELTANS,"Yo, si ir pamaciba :D");
    SendClientMessage(playerid,SARKANS,"-------------------");
    TogglePlayerControllable(playerid, 0);
    SetTimer("step1", 5000, 0);
    return 1;
    }
}
pawn Код:
public step1(playerid)
{
    SendClientMessage(playerid, DZELTANS, "Pamaciba beigusies");
    TogglePlayerControllable(playerid, 1);
    if(gTeam[playerid] = komanda1)
            {
                SetPlayerPos(playerid,3632.3020,-1604.2275,16.7541);
                return 1;
            }
    if(gTeam[playerid] = komanda2)
            {
                SetPlayerPos(playerid,3972.4431,-1438.9698,15.6065);
                return 1;
            }
    return 1;
}

When i spawn, tutorial is starting.. After 5 sec, it should go to next step (Public step1), but nothing happens.. public step1 is not starting..


Re: What's wrong with this script? - Torran - 05.03.2010

Ok, I spotted as soon as i saw your code what was wrong!

You didnt set a timer to start part 2


Re: What's wrong with this script? - SaW_[VrTx] - 05.03.2010

Quote:
Originally Posted by Torran
Ok, I spotted as soon as i saw your code what was wrong!

You didnt set a timer to start part 2
And what's this?
pawn Код:
SetTimer("step1", 5000, 0);



Re: What's wrong with this script? - Fj0rtizFredde - 05.03.2010

Try to use SetTimerEx and see if that works? :P


Re: What's wrong with this script? - Torran - 05.03.2010

Oh i didnt see that,
But if its a tutorial i dont recommend using that code..


Re: What's wrong with this script? - Razvann - 05.03.2010

pawn Код:
public step1(playerid)
{
SendClientMessage(playerid, DZELTANS, "Pamaciba beigusies");
TogglePlayerControllable(playerid, 1);
if(gTeam[playerid] == komanda1)
{
SetPlayerPos(playerid,3632.3020,-1604.2275,16.7541);
return 1;
}
    if(gTeam[playerid] == komanda2)
{
SetPlayerPos(playerid,3972.4431,-1438.9698,15.6065);
return 1;
}
return 1;
}



Re: What's wrong with this script? - SaW_[VrTx] - 05.03.2010

Still not working.. There is something wrong about timer. Also SetTimerEx is not working.
EDIT: I found what's problem. That callback is working only for player with ID 0. Why?


Re: What's wrong with this script? - Torran - 05.03.2010

Have you treid this:

pawn Код:
public step1(playerid)
{
SendClientMessage(playerid, DZELTANS, "Pamaciba beigusies");
TogglePlayerControllable(playerid, 1);
if(gTeam[playerid] == komanda1)
{
SetPlayerPos(playerid,3632.3020,-1604.2275,16.7541);
}
 if(gTeam[playerid] == komanda2)
{
SetPlayerPos(playerid,3972.4431,-1438.9698,15.6065);
}
}
I dont return 1; in all the callbacks that i have made and they work so maybe try that? Idk might not make a difference but idkl= try it


Re: What's wrong with this script? - SaW_[VrTx] - 05.03.2010

Quote:

EDIT: I found what's problem. That callback is working only for player with ID 0. Why?




Re: What's wrong with this script? - Torran - 05.03.2010

It should'nt be? It should be working for all,