Fasted way? - 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: Fasted way? (
/showthread.php?tid=202897)
Fasted way? -
Face9000 - 25.12.2010
Hey all,i need a "speed" tip.
I need to use the case function to switch wanted level fast and showing messages.
I've this:
pawn Код:
if(GetPlayerWantedLevel(playerid) > 1)
{
new string [100];
new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof(pName));
format(string, sizeof(string), "%s has now wanted level 1.", pName);
SendClientMessageToAll(COLOR_ORANGE, string);
new str[100];
format(str,sizeof str,"0,4%s has now wanted level 1.", pName);
IRC_GroupSay(gGroupID, IRC_CHANNEL, str);
}
How i can do in a fast way with case?
Ex: case 1 "player blabla wanted level 1)
case 2 "player bla bla wanted level 2
Etc..
Thanks.
AW: Fasted way? -
EthanR - 25.12.2010
Post your GetPlayerWantedLevel function please
Re: Fasted way? -
Face9000 - 25.12.2010
It's showed above ^.
AW: Fasted way? -
EthanR - 25.12.2010
Alright it seems more like i'm not able to really get the point of what you want lol. You're wanting to have a global message disaplayed whenever the player gains +1 wanted level?
Код:
if(GetPlayerWantedLevel(playerid) != 0)
{
new wantedlevel;
new string [100];
new pName[MAX_PLAYER_NAME];
if(GetPlayerWantedLevel(playerid) == 1) { wantedlevel = 1; }
if(GetPlayerWantedLevel(playerid) == 2) { wantedlevel = 2; }
if(GetPlayerWantedLevel(playerid) == 3) { wantedlevel = 3; }
if(GetPlayerWantedLevel(playerid) == 4) { wantedlevel = 4; }
if(GetPlayerWantedLevel(playerid) == 5) { wantedlevel = 5; }
if(GetPlayerWantedLevel(playerid) == 6) { wantedlevel = 6; }
GetPlayerName(playerid, pName, sizeof(pName));
format(string, sizeof(string), "%s has now wanted level %d.", pName, wantedlevel);
SendClientMessageToAll(COLOR_ORANGE, string);
new str[100];
format(str,sizeof str,"0,4%s has now wanted level %d.", pName, wantedlevel);
IRC_GroupSay(gGroupID, IRC_CHANNEL, str);
}
just an example, ^ but should work.
Re: Fasted way? -
Jochemd - 25.12.2010
pawn Код:
switch(GetPlayerWantedLevel(playerid)
Re: Fasted way? -
Face9000 - 25.12.2010
Quote:
Originally Posted by Jochemd
pawn Код:
switch(GetPlayerWantedLevel(playerid)
|
How to use it?
EthanR is what i asked
Re: Fasted way? -
Mike_Peterson - 25.12.2010
pawn Код:
switch(GetPlayerWantedLevel(playerid))
{
case 0:
{
// wantedlevel is 0
}
case 1:
{
// wantedlevel is 1
}
case 2:
{
// wantedlevel is 2
}
Re: Fasted way? -
Face9000 - 25.12.2010
Good.
Thanks!
Where i should add that switch?
Re: Fasted way? -
Ricop522 - 26.12.2010
Try:
pawn Код:
if(GetPlayerWantedLevel(playerid) > 1)
{
new string [100];
new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof(pName));
switch(GetPlayerWantedLevel(playerid))
{
case 0:
{
format(string, sizeof(string), "%s has now wanted level 0.", pName);
}
case 1:
{
format(string, sizeof(string), "%s has now wanted level 1.", pName);
}
case 2:
{
format(string, sizeof(string), "%s has now wanted level 2.", pName);
}
//And more...
SendClientMessageToAll(COLOR_ORANGE, string);
IRC_GroupSay(gGroupID, IRC_CHANNEL, string);
}
Re: Fasted way? -
Joe Staff - 26.12.2010
What's wrong with "wantedlevel=GetPlayerWantedLevel(playerid)" or
"format(string,100,"%s now has a wanted level of %d",pName,GetPlayerWantedLevel(playerid));