SA-MP Forums Archive
Id 0 Command Processing - 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: Id 0 Command Processing (/showthread.php?tid=205499)



Id 0 Command Processing - Blade_Cervetti - 01.01.2011

Hello,

I'm in the process of creating a new script for my community. I have created an engine system using textdraws but for some reason teh command only works properly for id 0. What is the issue? Any help is appreciated!




Chains Community


Re: Id 0 Command Processing - Grim_ - 01.01.2011

How about you show us the code?


Re: Id 0 Command Processing - Blade_Cervetti - 01.01.2011

pawn Код:
if(strcmp(cmd, "/startengine",true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if((GetPlayerState(playerid) == PLAYER_STATE_DRIVER))
            {
                GameTextForPlayer(playerid, " ~g~Starting....", 4000, 3);
                StartTimer = SetTimer("StartTime", 1000, 0);
            }
        }
        return 1;
    }
pawn Код:
public StartTime(playerid)
{
    KillTimer(StartTimer);
    StartTimer2 = SetTimer("StartTime2", 1000, 0);
    return 1;
}
There is more that includes our most unique feature but I wont include this part. I have already checked it and its good!


Re: Id 0 Command Processing - _rAped - 01.01.2011

Quote:
Originally Posted by Blade_Cervetti
Посмотреть сообщение
pawn Код:
if(strcmp(cmd, "/startengine",true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if((GetPlayerState(playerid) == PLAYER_STATE_DRIVER))
            {
                GameTextForPlayer(playerid, " ~g~Starting....", 4000, 3);
                StartTimer = SetTimer("StartTime", 1000, 0);
            }
        }
        return 1;
    }
pawn Код:
public StartTime(playerid)
{
    KillTimer(StartTimer);
    StartTimer2 = SetTimer("StartTime2", 1000, 0);
    return 1;
}
SetTimerEx()


Re: Id 0 Command Processing - Grim_ - 01.01.2011

pawn Код:
if(strcmp(cmdtext, "/startengine", true) == 0)
Also, StartTime doesn't need the playerid parameter.
pawn Код:
public StartTime( )



Re: Id 0 Command Processing - Blade_Cervetti - 01.01.2011

Could you explain the difference between SetTimer And SetTimerEx, wiki doesnt make any sense to me :P!


Re: Id 0 Command Processing - Grim_ - 01.01.2011

SetTimerEx is used to pass extra parameters through the callback. For example, your example
StartTime( playerid ) - With SetTimerEx, you can pass the 'playerid' parameter. The format would be as so:
pawn Код:
SetTimerEx( "StartTime", 1000, false, "i", playerid );
// 1000 = time
// false = don't repeat
// "i" = the format (integer for 'playerid')
// playerid = the parameter to pass
It's hard to explain, but once you understand it, it's nothing!


Re: Id 0 Command Processing - Blade_Cervetti - 01.01.2011

I think I understand it, Let me edit and I will repost the code and see fi it looks right then!

pawn Код:
public StartTime()
{
    KillTimer(StartTimer);
    StartTimer2 = SetTimerEx( "StartTime2", 1000, false, "i", playerid );
    return 1;
}
I am now getting undefined symbol "playerid". I'm sorry it's been a long time since I've scripted so I kindof forgot everything, it wil come back to me though, I hope :P!


Re: Id 0 Command Processing - [03]Garsino - 01.01.2011

And can't you just set the timer rate to 2 seconds instead of 1 seconds. Since the only thing your timer does is to kill the current timer (wich would've ended anyway) and then start a new 1 second timer.. And then you can just remove the public "StartTime".
pawn Код:
if(strcmp(cmd, "/startengine",true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if((GetPlayerState(playerid) == PLAYER_STATE_DRIVER))
            {
                GameTextForPlayer(playerid, " ~g~Starting....", 4000, 3);
                StartTimer2 = SetTimer("StartTime2", 2000, 0);
            }
        }
        return 1;
    }



Re: Id 0 Command Processing - Blade_Cervetti - 01.01.2011

I updated my post~!!