Class request CALLBACK
#1

I have that:

pawn Код:
public OnGameModeInit()
{
   AddPlayerClass(165, 0.0, 0.0, 0.0, 90, 23,9999,28,9999,31,9999); // security
    AddPlayerClass(285, 0.0, 0.0, 0.0, 90, 22,9999,32,9999,30,9999); // Police
    AddPlayerClass(287, 0.0, 0.0, 0.0, 90, 24,9999,32,9999,26,9999); // army
    AddPlayerClass(279, 0.0, 0.0, 0.0, 90, 9,1,28,9999,33,9999); // firefighter
    AddPlayerClass(276, 0.0, 0.0, 0.0, 90, 24,9999,29,9999,34,9999); // Medic
    return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
    SetPlayerPos(playerid, 2022.36, 1329.58, 22.52);
    SetPlayerCameraPos(playerid, 2022.21, 1325.15, 21.68);
    SetPlayerCameraLookAt(playerid, 2022.36, 1329.58, 22.52);
    SetPlayerFacingAngle(playerid, 180.0);
    if(classid == 165)
    {
      GameTextForPlayer(playerid, "~g~Security",5000,5);
      return 1;
    }
    if(classid == 285)
    {
       GameTextForPlayer(playerid,"~r~Police",5000,5);
       return 1;
    }
    if(classid == 287)
    {
       GameTextForPlayer(playerid,"~p~Army",5000,5);
       return 1;
    }
    if(classid == 279)
    {
       GameTextForPlayer(playerid,"~r~Firefighter",5000,5);
       return 1;
    }
    if(classid == 276)
    {
       GameTextForPlayer(playerid,"~b~Medic",5000,5);
       return 1;
    }
    return 1;
}
And when I choose the class, on the request and spawn screen, doesn't shows up the GameText. What's wrong ther'?
Reply
#2

classid isnt the skinid, classid is id of skin in your server, for example when you connect it shows skinid 0 if you press key right its classid 1
hard to explain
id use switch(classid) rather than if, switch should be faster
Reply
#3

Quote:
Originally Posted by ******
Посмотреть сообщение
Do:

pawn Код:
printf("Security classid: %d", AddPlayerClass(165, 0.0, 0.0, 0.0, 90, 23,9999,28,9999,31,9999));
Thanks. Didn't know it was to count since the first line which added the first class on OnGameModeInit
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)