Help me please !! REP++ -
Vizi - 15.08.2012
Hi. how i can make 2function on 1 command ?exemple
1 command for Admin and GameMaster(Player+)
command /on
When i am a admin and i write /on to Show "Admin BLABLA is on duty"
When i am a GameMaste to show "GameMAster blabla is on duty"
I have this but when i am a admin and write /on shows
"Admin blabla is on duty"
"GameMaster blabla is on duty"
why ?
here is the command
pawn Код:
//------------------------------------------------------------------------------
if (strcmp(cmd,"/on",true) == 0)
{
if(IsPlayerConnected(playerid))
{
if (PlayerInfo[playerid][pAdmin] >= 1)
{
new sMsg[ 128 ];
GetPlayerName( playerid, sMsg, MAX_PLAYER_NAME );
SetPlayerColor(playerid, COLOR_GROVE);
SetPlayerArmour(playerid, 10000.0);
SetPlayerHealth(playerid, 10000.0);
format( sMsg, sizeof( sMsg ), "(GC)Admin %s e na dolznost.", sMsg );
SendClientMessageToAll(COLOR_LIGHTRED, sMsg);
SetPlayerAttachedObject(playerid, 3, 19065, 2, 0.120000, 0.040000, -0.003500, 0, 100, 100, 1.4, 1.4, 1.4);
OnDuty[playerid] = 1;
}
else
{
SendClientMessage(playerid, COLOR_RED, "{FF4040}GRESKA:{FFFFFF}Ne ste Ovlasteni za ovaa Komanda.");
return 1;
}
if (PlayerInfo[playerid][pGameMaster] >= 1 || PlayerInfo[playerid][pGameMaster] <= 3)
{
new sMsg[ 128 ];
GetPlayerName( playerid, sMsg, MAX_PLAYER_NAME );
SetPlayerColor(playerid, COLOR_DBLUE);
SetPlayerArmour(playerid, 10000.0);
SetPlayerHealth(playerid, 10000.0);
format( sMsg, sizeof( sMsg ), "(GC)GameMaster %s e na dolznost.", sMsg );
SendClientMessageToAll(COLOR_LIGHTRED, sMsg);
SetPlayerAttachedObject(playerid, 3, 19065, 2, 0.120000, 0.040000, -0.003500, 0, 100, 100, 1.4, 1.4, 1.4);
OnDuty[playerid] = 1;
}
else
{
SendClientMessage(playerid, COLOR_RED, "{FF4040}GRESKA:{FFFFFF}Ne ste Ovlasteni za ovaa Komanda.");
return 1;
}
}
return 1;
}
Re: Help me please !! REP++ -
[DOG]irinel1996 - 15.08.2012
I don't understand very well your problem, but give a try:
pawn Код:
if (strcmp(cmd,"/on",true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pGameMaster] >= 1 || PlayerInfo[playerid][pGameMaster] <= 3)
{
new sMsg[ 128 ];
GetPlayerName( playerid, sMsg, MAX_PLAYER_NAME );
SetPlayerColor(playerid, COLOR_DBLUE);
SetPlayerArmour(playerid, 10000.0);
SetPlayerHealth(playerid, 10000.0);
format( sMsg, sizeof( sMsg ), "(GC)GameMaster %s e na dolznost.", sMsg );
SendClientMessageToAll(COLOR_LIGHTRED, sMsg);
SetPlayerAttachedObject(playerid, 3, 19065, 2, 0.120000, 0.040000, -0.003500, 0, 100, 100, 1.4, 1.4, 1.4);
OnDuty[playerid] = 1;
}
else if(PlayerInfo[playerid][pAdmin] >= 1)
{
new sMsg[ 128 ];
GetPlayerName( playerid, sMsg, MAX_PLAYER_NAME );
SetPlayerColor(playerid, COLOR_GROVE);
SetPlayerArmour(playerid, 10000.0);
SetPlayerHealth(playerid, 10000.0);
format( sMsg, sizeof( sMsg ), "(GC)Admin %s e na dolznost.", sMsg );
SendClientMessageToAll(COLOR_LIGHTRED, sMsg);
SetPlayerAttachedObject(playerid, 3, 19065, 2, 0.120000, 0.040000, -0.003500, 0, 100, 100, 1.4, 1.4, 1.4);
OnDuty[playerid] = 1;
}
else
{
SendClientMessage(playerid, COLOR_RED, "{FF4040}GRESKA:{FFFFFF}Ne ste Ovlasteni za ovaa Komanda.");
return 1;
}
}
return 1;
}
PD: Don't write "REP+" in the title, maybe that's the reason you don't get any answer.
Re: Help me please !! REP++ -
IceMeteor - 15.08.2012
pawn Код:
if (strcmp(cmd,"/on",true) == 0)
{
if(IsPlayerConnected(playerid))
{
if (PlayerInfo[playerid][pAdmin] >= 1)
{
new sMsg[ 128 ];
GetPlayerName( playerid, sMsg, MAX_PLAYER_NAME );
SetPlayerColor(playerid, COLOR_GROVE);
SetPlayerArmour(playerid, 10000.0);
SetPlayerHealth(playerid, 10000.0);
format( sMsg, sizeof( sMsg ), "(GC)Admin %s e na dolznost.", sMsg );
SendClientMessageToAll(COLOR_LIGHTRED, sMsg);
SetPlayerAttachedObject(playerid, 3, 19065, 2, 0.120000, 0.040000, -0.003500, 0, 100, 100, 1.4, 1.4, 1.4);
OnDuty[playerid] = 1;
}
else if (PlayerInfo[playerid][pGameMaster] >= 1 || PlayerInfo[playerid][pGameMaster] <= 3)
{
new sMsg[ 128 ];
GetPlayerName( playerid, sMsg, MAX_PLAYER_NAME );
SetPlayerColor(playerid, COLOR_DBLUE);
SetPlayerArmour(playerid, 10000.0);
SetPlayerHealth(playerid, 10000.0);
format( sMsg, sizeof( sMsg ), "(GC)GameMaster %s e na dolznost.", sMsg );
SendClientMessageToAll(COLOR_LIGHTRED, sMsg);
SetPlayerAttachedObject(playerid, 3, 19065, 2, 0.120000, 0.040000, -0.003500, 0, 100, 100, 1.4, 1.4, 1.4);
OnDuty[playerid] = 1;
}
else
{
SendClientMessage(playerid, COLOR_RED, "{FF4040}GRESKA:{FFFFFF}Ne ste Ovlasteni za ovaa Komanda.");
return 1;
}
}
return 1;
}
Re: Help me please !! REP++ -
Vizi - 15.08.2012
aha i need to add else if right for that ?
Re: Help me please !! REP++ -
Kalroz - 15.08.2012
Can you please explain your prob?
Re: Help me please !! REP++ -
[DOG]irinel1996 - 15.08.2012
Quote:
Originally Posted by Vizi
aha i need to add else if right for that ?
|
Yes.
Have to say that if you're GameMaster and Admin at the same time, in my case, my command will send the message as GameMaster. It can be change, but it isn't a problem, I think.