< > & Spawn button - 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: < > & Spawn button (
/showthread.php?tid=323303)
< > & Spawn button -
Dripac - 05.03.2012
Alright, i fixed the spawn button, means if the player presses on it, it'll say "You need to login first"
but is it possible to make the same on the other 2 buttons?
Re: < > & Spawn button -
iTorran - 05.03.2012
Never tried it before but..
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
SendClientMessage(playerid, -1, "Please login");
return 0;
}
You will need to edit it ofc.
AW: < > & Spawn button -
Dripac - 05.03.2012
Nope, it doesn't work
Re: AW: < > & Spawn button -
vassilis - 05.03.2012
Quote:
Originally Posted by Dripac
Nope, it doesn't work
|
you have to use OnPlayerRequestSpawn callback
and switch classes?
Re: AW: < > & Spawn button -
Konstantinos - 05.03.2012
Quote:
Originally Posted by vassilis
you have to use OnPlayerRequestSpawn callback
and switch classes?
|
He should use it on the OnPlayerRequestSpawn for the first case on "Spawn Button"
For the two buttons ( < > ) use as iTorran said the OnPlayerRequestClass Callback.
pawn Код:
public OnPlayerRequestClass( playerid, classid )
{
if( !IsPlayerLogin[ playerid ] ) // ofc replace it with your variable's name.
{
SendClientMessage( playerid, -1, "You need to login first" );
return 0;
}
return 1;
}
Re: < > & Spawn button -
Twisted_Insane - 05.03.2012
Or, you're checking it with a boolean:
pawn Код:
bool:loggedIn[MAX_PLAYERS];
Under "OnPlayerLogin" add this:
pawn Код:
loggedIn[playerid] == true;
Then, you could - as Dwane already said - check whether the player's logged in or not:
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
if(loggedIn[playerid] == false)
{
SendClientMessage(playerid, -1, "You'll have to login before changing / choosing classes!");
return 0;
}
//rest
Re: < > & Spawn button -
Dripac - 05.03.2012
Alright guys, i will try it