Prob with GameTextForPlayer
#1

Hey, is there any way to add a GameTextForPlayer by the RequestClass function? I want to do that so, that if a is by the class selection there should come always a gametextforplayer by each skin. For example upstrairs should stay: Civilian, etc..
How can I add that for each skin? And how to remove it after the player has chosen a class?
Please help

Regards
Reply
#2

pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    if(classid == 0)
    {
        GameTextForPlayer(playerid,"Text",999999,3);
    }
    else if(classid == 1)
    {
        GameTextForPlayer(playerid,"Text2",999999,3);
    }
}
//etc.
Reply
#3

Quote:
Originally Posted by Mean
Посмотреть сообщение
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    if(classid == 0)
    {
        GameTextForPlayer(playerid,"Text",999999,3);
    }
    else if(classid == 1)
    {
        GameTextForPlayer(playerid,"Text2",999999,3);
    }
}
//etc.
Actually, it's better switch:

pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    switch(classid)
    {
        case 0:GameTextForPlayer(playerid,"Class 1",5000,3);
        case 1:GameTextForPlayer(playerid,"Class 2",5000,3);
        case 2:GameTextForPlayer(playerid,"Class 3",5000,3);
        //And so on...
    }
}
Reply
#4

Niether are 'better', explain why switch is better than normal if statements?

It's just a matter of preference, I prefer if statements because they use up less lines, and look better structured, both are the same speed, and do the same thing.
Reply
#5

Quote:
Originally Posted by Joe_
Посмотреть сообщение
Niether are 'better', explain why switch is better than normal if statements?

It's just a matter of preference, I prefer if statements because they use up less lines, and look better structured, both are the same speed, and do the same thing.
****** made a topic explaining that switch is FASTER than if statements.
Reply
#6

I don't know, I prefer if statements, but as you say.
Reply
#7

@NuggaN_
We would like to know if it worked...
Reply
#8

i'm looking for the same but when im switching classes it's stayed appeared for 5 seconds or something even when im at another class whith another text.

I need te following;

i got for example 3 classes
clas 1 = cop
clas 2 = farmer
clas 3 = chicken bell

then i get 3 AddPlayerClasses and i wanna have a GameTextForPlayer on every class,
so i switch thoug the classes the right class message would be showen and whith this code it stays for about 5 seconds then i have to wait 5 seconds every class. it must work faster because i've seen it on other servers

Sorry for my bad englisch i hope u guys can help me out

Kind Regards
[JJ]Jordy
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)