SA-MP Forums Archive
OnPlayerRequestClass - 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: OnPlayerRequestClass (/showthread.php?tid=340887)



OnPlayerRequestClass - iGetty - 08.05.2012

For some reason, OnPlayerRequestClass isn't working correctly.

I use this:

pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    if(gPlayerLogged[playerid] == 0)
    {
        ShowPlayerDialog(playerid,1234, DIALOG_STYLE_MSGBOX,"Server Rules","Cheating and Hacking is not allowed\nAdvertising other Server's is not allowed\nSpawn Killing is not allowed\nUse of foul language against opponents is forbidden (EG: Swearing/Name calling)","Accept","Refuse");
    }
    else return 1;
   
    if(classid == 0)
    {
        GameTextForPlayer(playerid, "~r~ARMY!~n~~w~M4 Carbine~n~9MM~n~MP5~n~SNIPER RIFLE~n~TEAR GAS~n~FRAG GRENADE", 3000, 5);
        SendClientMessage(playerid, GREY, "ARMY");
    }
    if(classid == 1)
    {
        GameTextForPlayer(playerid, "~r~ENEMY!~n~~w~AK-47~n~9MM~n~MP5~n~SNIPER RIFLE~n~TEAR GAS~n~FRAG GRENADE", 3000, 5);
        SendClientMessage(playerid, GREY, "ENEMY");
    }
   
    SetPlayerPos(playerid, player_x,player_y,player_z);
    SetPlayerFacingAngle(playerid, player_angle);
    SetPlayerCameraPos(playerid, camera_x,camera_y,camera_z);
    SetPlayerCameraLookAt(playerid, player_x,player_y,player_z);
    ApplyAnimation(playerid,"DANCING","DNCE_M_B",4.0,1,0,0,0,-1);
    if (PlayerInfo[playerid][SpawnDance]) PlayerInfo[playerid][SpawnTimer] = SetTimerEx("MoveCamera", moving_speed, true, "i", playerid);
    PlayerInfo[playerid][SpawnDance] = false;
    SetPlayerTeamFromClass(playerid, classid);
    return 1;
}
When I go left and right (I only have two classes), it doesn't recognise it and doesn't come up with any text...

It shows the two characters that I have, but still doesn't do anything? What's wrong?

Thanks.

What's the problem?


Re: OnPlayerRequestClass - warcodes_ - 08.05.2012

Код:
else return 1;
This tells pawno, if the player is not found to be logged in, stop what your doing.

Try making the lower code an else statement.


Re: OnPlayerRequestClass - iGetty - 08.05.2012

THANK YOU!!!!!!! :')

It's fixed! Repped.