08.07.2011, 14:44
Why using 2 commands? Why not use 1 command that toggle's it on or off by using a variable. In my opinion it would be more effective.
Here an example:
And in every of your teleport commands, add the codes that is shown below.
There is no need to add (view codes below), because it there isnt any codes needed when ShowMessages is false (ShowMessages == 0).
This seems very complecated but once you get it its very simple, but I hope this helps.
Regards,
Rolyy
Here an example:
pawn Код:
//Somewhere at the beginning of the script
new ShowMessages[MAX_PLAYERS];
//under OnPlayerConnect
ShowMessages[playerid] = 1;
//under OnPlayerCommand
if(strcmp(cmd, "/togglemessage", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(ShowMessages[playerid] == 1)
{
ShowMessages[playerid] = 0;
SendClientMessage(playerid, COLOR_WHITE, "You have {00FFFF}Disabled {FFFFFF}the messages, Type /togglemessage again to toggle it."); //Not sure if both colours are correct :P just a guess.
return 1;
}
if(ShowMessages[playerid] == 0)
{
ShowMessages[playerid] = 1;
SendClientMessage(playerid, COLOR_WHITE, "You have {FFFF00}Enabled{FFFFFF} the messages, Type /togglemessage again to toggle it."); //Not sure if both colours are correct :P just a guess.
return 1;
}
}
return 1;
}
And in every of your teleport commands, add the codes that is shown below.
pawn Код:
if(ShowMessages[playerid] == 1)
{
SendClientMessage(playerid, 0x........, "You have been teleported to ...");
}
pawn Код:
if(ShowMessages[playerid] == 0)
{
//Add Pawno Codes
}
This seems very complecated but once you get it its very simple, but I hope this helps.
Regards,
Rolyy