Posts: 117
Threads: 4
Joined: Feb 2018
Quote:
Originally Posted by Ermanhaut
pawn Код:
// pPM must be changed to bool:pPM = true and so on...
CMD:toggle(playerid, params[]) {
static settings[24], info[24]; if(!sscanf(params, "s[24]s[24]", settings, info) {
if(!strcmp(settings, "pm", true) {
pInfo[playerid][pPM] = !pInfo[playerid][pPM]; // This makes the value switch. (true becomes false, false becomes true) if(pInfo[playerid][pPM]) return SendClientMessage(playerid, -1, "Now you're getting PMs!"); else return SendClientMessage(playerid, -1, "Now you're not getting PMs."); } else if(!strcmp(settings, "testerchat", true)) {
pInfo[playerid][tChat] = !pInfo[playerid][tChat]; if(pInfo[playerid][pPM]) return SendClientMessage(playerid, -1, "Now you'll read the Tester Chat!"); else return SendClientMessage(playerid, -1, "Now you're reading the Tester Chat."); } else return SendClientMessage(playerid, -1, "The option typed in wasn't found."); } else return SendClientMessage(playerid, -1, "Use /toggle [Function]."), SendClientMessage(playerid, -1, "Options: PM, TesterChat, AdminChat, Radio"); }
|
You shouldn't spoonfeed code. The guy is no longer going to learn anything from you doing that. Also, the statement you made about the bools aren't necessarily true considering that 0 = false and 1 = true. It will, however, prevent mentions of compiler warnings
if you are using the community pawn-lang compiler, first maintained by zeex.