Help please - 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: Help please (
/showthread.php?tid=299053)
Help please -
bartje01 - 23.11.2011
Hey all.
Why does the gametext show above every skin and not just 280 281 and 282?
pawn Код:
new v = GetPlayerSkin(playerid);
if(v == 280||281||282)
{
GameTextForPlayer(playerid,"Cops",1500,4);
}
Re: Help please -
SchurmanCQC - 23.11.2011
Try this.
pawn Код:
new v = GetPlayerSkin(playerid);
switch(v)
{
case 280 .. 282: GameTextForPlayer(playerid,"Cops",1500,4);
default: return 0;
}
Re: Help please -
MP2 - 23.11.2011
pawn Код:
if(v == 280 || v == 281 || v == 282)
If you have lots of skins like this, it would be best to do this:
pawn Код:
switch(GetPlayerSkin(playerid))
{
case 0: GameTextForPlayer(...); // Shows if skin is 0
case 1: GameTextForPlayer(...); // Shows if skin is 1
case 2, 3, 4, 5: GameTextForPlayer(...); // Shows if skin is 2, 3, 4 or 5
case 6 .. 10: GameTextForPlayer(...); // Shows if skin is 6, 7, 8, 9 or 10
case 11: GameTextForPlayer(...); // Shows if skin is 11
}
Re: Help please -
SchurmanCQC - 23.11.2011
Quote:
Originally Posted by MP2
pawn Код:
if(v == 280 || v == 281 || v == 282)
If you have lots of skins like this, it would be best to do this:
pawn Код:
switch(GetPlayerSkin(playerid)) { case 0: GameTextForPlayer(...); // Shows if skin is 0 case 1: GameTextForPlayer(...); // Shows if skin is 1 case 2, 3, 4, 5: GameTextForPlayer(...); // Shows if skin is 2, 3, 4 or 5 case 6 .. 10: GameTextForPlayer(...); // Shows if skin is 6, 7, 8, 9 or 10 case 11: GameTextForPlayer(...); // Shows if skin is 11 }
|
Beat ya to it.
Re: Help please -
bartje01 - 23.11.2011
Thanks both. Works perfect.
Re: Help please -
grand.Theft.Otto - 23.11.2011
Quote:
Originally Posted by Schurman
Beat ya to it.
|
Quote:
Originally Posted by MP2
Fucking post limit :<
|
Were those really needed ?
Anyways, remember:
If you want to add more things other than GameTextForPlayer, like SendClientMessage, ApplyAnim, variables, etc... you would have to do:
pawn Код:
switch(GetPlayerSkin(playerid))
{
case 0:
{
GameTextForPlayer(...);
// sendclientmessage
// applyanim
// etc
}
case 1: GameTextForPlayer(...); // Shows if skin is 1
case 2, 3, 4, 5: GameTextForPlayer(...); // Shows if skin is 2, 3, 4 or 5
case 6 .. 10: GameTextForPlayer(...); // Shows if skin is 6, 7, 8, 9 or 10
case 11: GameTextForPlayer(...); // Shows if skin is 11
}
Not all need to have text/animations though.