Fasted way?
#1

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.
Reply
#2

Post your GetPlayerWantedLevel function please
Reply
#3

It's showed above ^.
Reply
#4

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.
Reply
#5

pawn Код:
switch(GetPlayerWantedLevel(playerid)
Reply
#6

Quote:
Originally Posted by Jochemd
Посмотреть сообщение
pawn Код:
switch(GetPlayerWantedLevel(playerid)
How to use it?

EthanR is what i asked
Reply
#7

pawn Код:
switch(GetPlayerWantedLevel(playerid))
{
case 0:
{
// wantedlevel is 0
}
case 1:
{
// wantedlevel is 1
}
case 2:
{
// wantedlevel is 2
}
Reply
#8

Good.

Thanks!

Where i should add that switch?
Reply
#9

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);
    }
Reply
#10

What's wrong with "wantedlevel=GetPlayerWantedLevel(playerid)" or
"format(string,100,"%s now has a wanted level of %d",pName,GetPlayerWantedLevel(playerid));
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)