SA-MP Forums Archive
Prob with GameTextForPlayer - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Prob with GameTextForPlayer (/showthread.php?tid=198593)



Prob with GameTextForPlayer - NuggaN_ - 12.12.2010

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


Re: Prob with GameTextForPlayer - Mean - 12.12.2010

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



Re: Prob with GameTextForPlayer - The_Moddler - 12.12.2010

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...
    }
}



Re: Prob with GameTextForPlayer - Joe_ - 12.12.2010

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.


Re: Prob with GameTextForPlayer - The_Moddler - 12.12.2010

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.


Re: Prob with GameTextForPlayer - Mean - 12.12.2010

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


Re: Prob with GameTextForPlayer - Mean - 13.12.2010

@NuggaN_
We would like to know if it worked...


Re: Prob with GameTextForPlayer - jordy.kiesebrink - 10.02.2011

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