SA-MP Forums Archive
Prevent to show SA:MP default class selection at player join. - 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: Prevent to show SA:MP default class selection at player join. (/showthread.php?tid=431469)



Prevent to show SA:MP default class selection at player join. - Helia - 18.04.2013

As title says I want to spawn the player as soon as he join the server.
How to this ?


Re: Prevent to show SA:MP default class selection at player join. - [Ro]DuReX - 18.04.2013

pawn Код:
public OnPlayerRequestClass(playerid,classid)
{
    SpawnPlayer(playerid);
    return 1;
}



Re: Prevent to show SA:MP default class selection at player join. - MP2 - 18.04.2013

AFAIK that doesn't work - you have to delay it on a timer (1 MS, or perhaps even 0 MS).


Re: Prevent to show SA:MP default class selection at player join. - Jay_ - 18.04.2013

Yes it does.

Also ensure that you have created at least one dud player class using AddPlayerClass. Or alternatively you could use SetSpawnInfo.


Re: Prevent to show SA:MP default class selection at player join. - [Ro]DuReX - 18.04.2013

Try this (tested):

pawn Код:
public OnPlayerRequestClass(playerid,classid)
{
    SetTimer("SpawnP", 1, false);
    return 1;
}

forward SpawnP(playerid);
public SpawnP(playerid)
{
    SpawnPlayer(playerid);
    return 1;
}



Re: Prevent to show SA:MP default class selection at player join. - DanLore - 18.04.2013

Wouldn't you need to use SetTimerEx, considering it's player-specific.

You're calling a function that requires a parameter, but you're not providing one

I'd say

pawn Код:
public OnPlayerRequestClass(playerid,classid)
{
    SetTimerEx("SpawnP", 1, false, "i", playerid);
    return 1;
}

forward SpawnP(playerid);
public SpawnP(playerid)
{
    SpawnPlayer(playerid);
    return 1;
}



Re: Prevent to show SA:MP default class selection at player join. - MP2 - 18.04.2013

Quote:
Originally Posted by Jay_
Посмотреть сообщение
Yes it does.
It doesn't; I just tested it.


Re: Prevent to show SA:MP default class selection at player join. - Jay_ - 18.04.2013

http://pastebin.com/PPWeH67x

Just ran this as a gamemode, worked fine.


Re: Prevent to show SA:MP default class selection at player join. - MP2 - 18.04.2013

Ah yes that does appear to work, although it doesn't work unless SetSpawnInfo has been used, even if AddPlayerClass is used. This may be rather useful for me - thanks.