Class Selection Music
#1

Heya,

I've been searching most of this afternoon and trying different things but I can't seem to get my class selection music to play....any chance anybody could give me a hand to fix it?

Here is my code:

pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    TogglePlayerControllable(playerid,0);
    PlayerPlaySound(playerid, 1185, 0.0,0.0,0.0);
    SetPlayerPos(playerid, 1498.7487,-945.5091,51.2734);
    SetPlayerCameraPos(playerid, 1502.2191,-943.7787,51.2934);
    SetPlayerCameraLookAt(playerid, 1498.7487,-945.5091,51.2734);
    SetPlayerFacingAngle(playerid,280);
 
    return 1;
}
Knowing my luck it will probably be the simplest little thing stopping it from playing. :L

Ashley
Reply
#2

What I did was put it for every case, and it works

Like this:

pawn Код:
case 0:
        {
            GameTextForPlayer(playerid, "~b~Los Santos Police Dept.", 500, 3);
            PlayerPlaySound(playerid, 1183, 0.0, 0.0, 0.0);
        }
        case 1:
        {
            GameTextForPlayer(playerid, "~b~San Feirro Police Dept.", 500, 3);
            PlayerPlaySound(playerid, 1183, 0.0, 0.0, 0.0);
        }
With proper indentation and stuff though... the forum just screws it up :P
Reply
#3

Right, i'm trying a different kinda of class slection code thingy,

Here is my diff pieces of code:

pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    SetPlayerClass(playerid, classid);
    SetupPlayerForClassSelection(playerid);
    gPlayerClass[playerid] = classid;
    switch (classid) {
    case 0:
{
    GameTextForPlayer(playerid, "~b~Test Spawn", 500, 3);
    PlayerPlaySound(playerid, 1185, 0.0, 0.0, 0.0);
}
    case 1:
{
    GameTextForPlayer(playerid, "~b~Test Spawn Two.", 500, 3);
    PlayerPlaySound(playerid, 1185, 0.0, 0.0, 0.0);
}
 }
    return 1;
}
and here is the other parts of it:

pawn Код:
SetupPlayerForClassSelection(playerid)
{
    TogglePlayerControllable(playerid,0)
    SetPlayerPos(playerid, 1498.7487,-945.5091,51.2734);
    SetPlayerCameraPos(playerid, 1502.2191,-943.7787,51.2934);
    SetPlayerCameraLookAt(playerid, 1498.7487,-945.5091,51.2734);
    SetPlayerFacingAngle(playerid,280);
    return 1;
}

SetPlayerClass(playerid, classid)
{
 switch(classid) {

 if (classid == 0)
    {
        pTeam[playerid] = TEAM_PILOT;
    }
  if (classid == 1)
    pTeam[playerid] = TEAM_TEST;
    }
}
and I'm getting the following errors, I've been trying for a while, any ideas?

Код:
C:\Documents and Settings\*******\Desktop\SA-MP 2.X LocalHost Server\gamemodes\twitchrp.pwn(808) : error 001: expected token: ";", but found "-identifier-"
C:\Documents and Settings\*******\Desktop\SA-MP 2.X LocalHost Server\gamemodes\twitchrp.pwn(818) : error 002: only a single statement (or expression) can follow each "case"
C:\Documents and Settings\*******\Desktop\SA-MP 2.X LocalHost Server\gamemodes\twitchrp.pwn(818 -- 819) : error 029: invalid expression, assumed zero
C:\Documents and Settings\*******\Desktop\SA-MP 2.X LocalHost Server\gamemodes\twitchrp.pwn(819) : warning 217: loose indentation
C:\Documents and Settings\*******\Desktop\SA-MP 2.X LocalHost Server\gamemodes\twitchrp.pwn(820) : error 029: invalid expression, assumed zero
C:\Documents and Settings\*******\Desktop\SA-MP 2.X LocalHost Server\gamemodes\twitchrp.pwn(823) : error 029: invalid expression, assumed zero
C:\Documents and Settings\*******\Desktop\SA-MP 2.X LocalHost Server\gamemodes\twitchrp.pwn(826) : warning 203: symbol is never used: "PlayerInfo"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


5 Errors.
Ashley
Reply
#4


TogglePlayerControllable(playerid,0)

should be


TogglePlayerControllable(playerid,0);
Reply
#5

Thanks I knew I'd get caught on something like that :L

I'm now getting this error:

Код:
C:\Documents and Settings\******\Desktop\SA-MP 2.X LocalHost Server\gamemodes\twitchrp.pwn(819) : error 002: only a single statement (or expression) can follow each "case"
C:\Documents and Settings\******\Desktop\SA-MP 2.X LocalHost Server\gamemodes\twitchrp.pwn(819 -- 820) : error 029: invalid expression, assumed zero
C:\Documents and Settings\******\Desktop\SA-MP 2.X LocalHost Server\gamemodes\twitchrp.pwn(820) : warning 217: loose indentation
C:\Documents and Settings\******\Desktop\SA-MP 2.X LocalHost Server\gamemodes\twitchrp.pwn(821) : error 029: invalid expression, assumed zero
C:\Documents and Settings\******\Desktop\SA-MP 2.X LocalHost Server\gamemodes\twitchrp.pwn(823) : warning 217: loose indentation
C:\Documents and Settings\******\Desktop\SA-MP 2.X LocalHost Server\gamemodes\twitchrp.pwn(824) : error 029: invalid expression, assumed zero
C:\Documents and Settings\******\Desktop\SA-MP 2.X LocalHost Server\gamemodes\twitchrp.pwn(827) : warning 203: symbol is never used: "PlayerInfo"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Reply
#6

When you have configured SetupPlayerForClassSelection- sound, use this under OnPlayerSpawn. It stops playing the music

pawn Код:
PlayerPlaySound(playerid, 1184, 2127.2194,2368.6323,10.8203); //Stop music
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)