SA-MP Forums Archive
How to make this? - 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: How to make this? (/showthread.php?tid=264325)



How to make this? - Markx - 25.06.2011

Hello all.

Well...
A part of OnPlayerConnect
pawn Код:
ShowRules(playerid);
SetTimer("HideRules", RulesTime*1000, false);
SetTimer("ShowRegisterLogin", RulesTime*1000, false);
I want to know how to make something like a timer,so i can call OnPlayerReuestClass after the player logs in, but how to make that?


Re: How to make this? - Donya - 25.06.2011

Under onplayerconnect, instead of returning 1;, return 0;

then after a player logins in, call "OnPlayerRequestClass(first_class_id_you_want_firs t);" (0 mostly)


Re: How to make this? - Markx - 25.06.2011

Quote:
Originally Posted by Donya
Посмотреть сообщение
return 0; under onplayerconnect, onplayerlogin, call OnPlayerRequestClass(playerid, class_id_u_want_first);
Didnt understand anything...
Thanks for helping anyway.


Re: How to make this? - Donya - 25.06.2011

read it again


Re: How to make this? - Markx - 25.06.2011

Okay, ill try that.

EDIT: Cant i just use OnPlayerRequestClass(playerid, classid); ?


Re: How to make this? - Willow - 25.06.2011

He helped you.

Use:

Код:
OnPlayerConnect(playerid);
{
return 0;
}
And In you Log in code add:

Код:
 OnPlayerRequestClass(playerid,classid);



Re: How to make this? - Donya - 25.06.2011

u have to put a classid......... 0 - thenumberofclasses u have


Re: How to make this? - rjjj - 25.06.2011

Quote:
Originally Posted by Markx
Посмотреть сообщение
Okay, ill try that.

EDIT: Cant i just use OnPlayerRequestClass(playerid, classid); ?
No, you can't , because when you try to do this, the OnPlayerRequestClass(playerid, classid) is called like a normal callback, in other words, only the code that is inside it will works, like :



pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    SendClientMessage(playerid,0xFFFFFFAA,"OnPlayerRequestClass was called :D !");
    return 1;
}


public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp("/test", cmdtext, true, 5))
    {
        CallLocalFunction("OnPlayerRequestClass","d",playerid);//Calls the OnPlayerRequestClass, but only the SendClientMessage code that is inside its will work. The selection of chars, teams and etc will won't appear :p.
        return 1;
    }
    return 0;
}


Well, i did a function to you, it should solve your problem :


pawn Код:
#define RequestClassForPlayer(%0);  ForceClassSelection(%0),SetPlayerHealth(%0,0),SpawnPlayer(%0);

I hope that i have helped .


Re: How to make this? - Donya - 25.06.2011

actually calling OnPlayerRequestClass(playerid, classid) raw can work. if u havent spawned yet lol..