31.03.2019, 18:11
as tried to edit the script, i fail because of my lake experience.
its a command to toggle other function
This is my edit,
the original
its a command to toggle other function
This is my edit,
Quote:
CMD:toggle(playerid, params[]) { new targetid; if(sscanf(params, "u", targetid)) { SendClientMessage(playerid, COLOR_GREY3, "[Usage]: /(tog)gle [option]"); SendClientMessage(playerid, COLOR_GREY3, "List of options: Textdraws, OOC, Global, Phone, Newbie, WalkieTalkie, Radio, Streams, News, Lands"); SendClientMessage(playerid, COLOR_GREY3, "List of options: SpawnCam, HUD, Admin, Helper, VIP, Faction, Gang, Whisper, Turfs"); } if(!strcmp(params, "textdraws", true)) { if(!PlayerInfo[playerid][pToggleTextdraws]) { PlayerTextDrawHide(playerid, PlayerInfo[playerid][pText][0]); PlayerTextDrawHide(playerid, PlayerInfo[playerid][pText][1]); PlayerTextDrawHide(playerid, PlayerInfo[playerid][pText][2]); PlayerTextDrawHide(playerid, PlayerInfo[playerid][pText][3]); PlayerTextDrawHide(playerid, PlayerInfo[playerid][pText][4]); PlayerTextDrawHide(playerid, PlayerInfo[playerid][pText][5]); TextDrawHideForPlayer(playerid, TimeTD); PlayerInfo[playerid][pToggleTextdraws] = 1; SendClientMessage(playerid, COLOR_AQUA, "Textdraws toggled. You will no longer see any textdraws."); } else { if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER && VehicleHasEngine(GetPlayerVehicleID(playerid))) { PlayerTextDrawShow(playerid, PlayerInfo[playerid][pText][1]); PlayerTextDrawShow(playerid, PlayerInfo[playerid][pText][2]); } if(PlayerInfo[playerid][pGPSOn]) { PlayerTextDrawShow(playerid, PlayerInfo[playerid][pText][0]); } if(PlayerInfo[playerid][pWatchOn]) { TextDrawShowForPlayer(playerid, TimeTD); } if(!PlayerInfo[playerid][pToggleHUD]) { PlayerTextDrawShow(playerid, PlayerInfo[playerid][pText][3]); PlayerTextDrawShow(playerid, PlayerInfo[playerid][pText][4]); } PlayerInfo[playerid][pToggleTextdraws] = 0; SendClientMessage(playerid, COLOR_AQUA, "Textdraws enabled. You will now see textdraws again."); } } else if(!strcmp(params, "ooc", true)) { if(!PlayerInfo[playerid][pToggleOOC]) { PlayerInfo[playerid][pToggleOOC] = 1; SendClientMessage(playerid, COLOR_AQUA, "OOC chat toggled. You will no longer see any messages in /o."); } else { PlayerInfo[playerid][pToggleOOC] = 0; SendClientMessage(playerid, COLOR_AQUA, "OOC chat enabled. You will now see messages in /o again."); } } else if(!strcmp(params, "global", true)) { if(!PlayerInfo[playerid][pToggleGlobal]) { PlayerInfo[playerid][pToggleGlobal] = 1; SendClientMessage(playerid, COLOR_AQUA, "Global chat toggled. You will no longer see any messages in /g."); } else { PlayerInfo[playerid][pToggleGlobal] = 0; SendClientMessage(playerid, COLOR_AQUA, "Global chat enabled. You can now speak to other players in /g."); } } else if(!strcmp(params, "phone", true)) { if(!PlayerInfo[playerid][pTogglePhone]) { if(PlayerInfo[playerid][pCallLine] != INVALID_PLAYER_ID) { return SendClientMessage(playerid, COLOR_GREY, "You can't do this while in a call."); } PlayerInfo[playerid][pTogglePhone] = 1; SendClientMessage(playerid, COLOR_AQUA, "Phone toggled. You will no longer receive calls or texts."); } else { PlayerInfo[playerid][pTogglePhone] = 0; SendClientMessage(playerid, COLOR_AQUA, "Phone enabled. You can now receive calls and texts again."); } } else if(!strcmp(params, "admin", true)) { if(!PlayerInfo[playerid][pAdmin]) { return SendClientMessage(playerid, COLOR_GREY, "You are not an admin and therefore cannot toggle this feature."); } if(!PlayerInfo[playerid][pToggleAdmin]) { PlayerInfo[playerid][pToggleAdmin] = 1; SendClientMessage(playerid, COLOR_AQUA, "Admin chat toggled. You will no longer see any messages in admin chat."); } else { PlayerInfo[playerid][pToggleAdmin] = 0; SendClientMessage(playerid, COLOR_AQUA, "Admin chat enabled. You will now see messages in admin chat again."); } } else if(!strcmp(params, "helper", true)) { if(!PlayerInfo[playerid][pHelper]) { return SendClientMessage(playerid, COLOR_GREY, "You are not a helper and therefore cannot toggle this feature."); } if(!PlayerInfo[playerid][pToggleHelper]) { PlayerInfo[playerid][pToggleHelper] = 1; SendClientMessage(playerid, COLOR_AQUA, "Helper chat toggled. You will no longer see any messages in helper chat."); } else { PlayerInfo[playerid][pToggleHelper] = 0; SendClientMessage(playerid, COLOR_AQUA, "Helper chat enabled. You will now see messages in helper chat again."); } } else if(!strcmp(params, "newbie", true)) { if(!PlayerInfo[playerid][pToggleNewbie]) { PlayerInfo[playerid][pToggleNewbie] = 1; SendClientMessage(playerid, COLOR_AQUA, "Newbie chat toggled. You will no longer see any messages in newbie chat."); } else { PlayerInfo[playerid][pToggleNewbie] = 0; SendClientMessage(playerid, COLOR_AQUA, "Newbie chat enabled. You will now see messages in newbie chat again."); } } else if(!strcmp(params, "walkietalkie", true)) { if(!PlayerInfo[playerid][pWalkieTalkie]) { return SendClientMessage(playerid, COLOR_GREY, "You don't have a walkie talkie."); } if(!PlayerInfo[playerid][pToggleWT]) { PlayerInfo[playerid][pToggleWT] = 1; SendClientMessage(playerid, COLOR_AQUA, "Walkie talkie toggled. You will no longer receive any messages on your walkie talkie."); } else { PlayerInfo[playerid][pToggleWT] = 0; SendClientMessage(playerid, COLOR_AQUA, "Walkie talkie enabled. You will now receive messages on your walkie talkie again."); } } else if(!strcmp(params, "radio", true)) { if(PlayerInfo[playerid][pFaction] == -1) { return SendClientMessage(playerid, COLOR_GREY, "You are not apart of a faction and therefore can't toggle your radio."); } if(!PlayerInfo[playerid][pToggleRadio]) { PlayerInfo[playerid][pToggleRadio] = 1; SendClientMessage(playerid, COLOR_AQUA, "Radio chat toggled. You will no longer receive any messages on your radio."); } else { PlayerInfo[playerid][pToggleRadio] = 0; SendClientMessage(playerid, COLOR_AQUA, "Radio chat enabled. You will now receive messages on your radio again."); } } else if(!strcmp(params, "streams", true)) { if(!PlayerInfo[playerid][pToggleMusic]) { PlayerInfo[playerid][pToggleMusic] = 1; StopAudioStreamForPlayer(playerid); SendClientMessage(playerid, COLOR_AQUA, "Music streams toggled. You will no longer hear any music played locally & globally."); } else { PlayerInfo[playerid][pToggleMusic] = 0; SendClientMessage(playerid, COLOR_AQUA, "Music streams enabled. You will now hear music played locally & globally again."); } } else if(!strcmp(params, "vip", true)) { if(!PlayerInfo[playerid][pVIPPackage]) { return SendClientMessage(playerid, COLOR_GREY, "You are not a VIP member and therefore cannot toggle this feature."); } if(!PlayerInfo[playerid][pToggleVIP]) { PlayerInfo[playerid][pToggleVIP] = 1; SendClientMessage(playerid, COLOR_AQUA, "VIP chat toggled. You will no longer see any messages in VIP chat."); } else { PlayerInfo[playerid][pToggleVIP] = 0; SendClientMessage(playerid, COLOR_AQUA, "VIP chat enabled. You will now see messages in VIP chat again."); } } else if(!strcmp(params, "faction", true)) { if(PlayerInfo[playerid][pFaction] == -1) { return SendClientMessage(playerid, COLOR_GREY, "You are not apart of a faction and therefore can't toggle this chat."); } if(!PlayerInfo[playerid][pToggleFaction]) { PlayerInfo[playerid][pToggleFaction] = 1; SendClientMessage(playerid, COLOR_AQUA, "Faction chat toggled. You will no longer see any messages in faction chat."); } else { PlayerInfo[playerid][pToggleFaction] = 0; SendClientMessage(playerid, COLOR_AQUA, "Faction chat enabled. You will now see messages in faction chat again."); } } else if(!strcmp(params, "gang", true)) { if(PlayerInfo[playerid][pGang] == -1) { return SendClientMessage(playerid, COLOR_GREY, "You are not a gang member and therefore can't toggle this chat."); } if(!PlayerInfo[playerid][pToggleGang]) { PlayerInfo[playerid][pToggleGang] = 1; SendClientMessage(playerid, COLOR_AQUA, "Gang chat toggled. You will no longer see any messages in gang chat."); } else { PlayerInfo[playerid][pToggleGang] = 0; SendClientMessage(playerid, COLOR_AQUA, "Gang chat enabled. You will now see messages in gang chat again."); } } else if(!strcmp(params, "news", true)) { if(!PlayerInfo[playerid][pToggleNews]) { PlayerInfo[playerid][pToggleNews] = 1; SendClientMessage(playerid, COLOR_AQUA, "News chat toggled. You will no longer see any news broadcasts."); } else { PlayerInfo[playerid][pToggleNews] = 0; SendClientMessage(playerid, COLOR_AQUA, "News chat enabled. You will now see news broadcasts again."); } } else if(!strcmp(params, "lands", true)) { callcmd::lands(playerid, "\1"); } else if(!strcmp(params, "whisper", true)) { if(PlayerInfo[playerid][pToggleWhisper] == 0) { PlayerInfo[playerid][pToggleWhisper] = 1; SendClientMessage(playerid, COLOR_AQUA, "Whisper chat disabled. You have blocked all incoming whispers."); } else { PlayerInfo[playerid][pToggleWhisper] = 0; SendClientMessage(playerid, COLOR_AQUA, "Whisper chat enabled. You will now receive whisper messages again."); } } else if(!strcmp(params, "spawncam", true)) { if(!PlayerInfo[playerid][pToggleCam]) { PlayerInfo[playerid][pToggleCam] = 1; SendClientMessage(playerid, COLOR_AQUA, "Spawn camera toggled. You will no longer see the camera effects upon spawning."); } else { PlayerInfo[playerid][pToggleCam] = 0; SendClientMessage(playerid, COLOR_AQUA, "Spawn camera enabled. You will now see the camera effects when you spawn again."); } } else if(!strcmp(params, "hud", true)) { if(!PlayerInfo[playerid][pToggleHUD]) { PlayerInfo[playerid][pToggleHUD] = 1; SendClientMessage(playerid, COLOR_AQUA, "HUD toggled. You will no longer see your health & armor indicators."); PlayerTextDrawHide(playerid, PlayerInfo[playerid][pText][3]); PlayerTextDrawHide(playerid, PlayerInfo[playerid][pText][4]); PlayerTextDrawHide(playerid, PlayerInfo[playerid][pText][5]); } else { PlayerInfo[playerid][pToggleHUD] = 0; SendClientMessage(playerid, COLOR_AQUA, "HUD enabled. You will now see your health & armor indicators again."); PlayerTextDrawShow(playerid, PlayerInfo[playerid][pText][3]); PlayerTextDrawShow(playerid, PlayerInfo[playerid][pText][4]); } } else if(!strcmp(params, "turfs", true)) { if(!PlayerInfo[playerid][pShowTurfs]) { ShowTurfsOnMap(playerid, true); SendClientMessage(playerid, COLOR_AQUA, "You will now see turfs on your mini-map."); } else { ShowTurfsOnMap(playerid, false); SendClientMessage(playerid, COLOR_AQUA, "You will no longer see any turfs on your mini-map."); } } else { SendClientMessage(playerid, COLOR_GREY3, "[Usage]: /(tog)gle [option]"); SendClientMessage(playerid, COLOR_GREY3, "List of options: Textdraws, OOC, Global, Phone, Newbie, WalkieTalkie, Radio, Streams, News, Lands"); SendClientMessage(playerid, COLOR_GREY3, "List of options: SpawnCam, HUD, Admin, Helper, VIP, Faction, Gang, Whisper, Turfs"); } return 1; } |
Quote:
CMD:toggle(playerid, params[]) { if(!strcmp(params, "textdraws", true)) { if(!PlayerInfo[playerid][pToggleTextdraws]) { PlayerTextDrawHide(playerid, PlayerInfo[playerid][pText][0]); PlayerTextDrawHide(playerid, PlayerInfo[playerid][pText][1]); PlayerTextDrawHide(playerid, PlayerInfo[playerid][pText][2]); PlayerTextDrawHide(playerid, PlayerInfo[playerid][pText][3]); PlayerTextDrawHide(playerid, PlayerInfo[playerid][pText][4]); PlayerTextDrawHide(playerid, PlayerInfo[playerid][pText][5]); TextDrawHideForPlayer(playerid, TimeTD); PlayerInfo[playerid][pToggleTextdraws] = 1; SendClientMessage(playerid, COLOR_AQUA, "Textdraws toggled. You will no longer see any textdraws."); } else { if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER && VehicleHasEngine(GetPlayerVehicleID(playerid))) { PlayerTextDrawShow(playerid, PlayerInfo[playerid][pText][1]); PlayerTextDrawShow(playerid, PlayerInfo[playerid][pText][2]); } if(PlayerInfo[playerid][pGPSOn]) { PlayerTextDrawShow(playerid, PlayerInfo[playerid][pText][0]); } if(PlayerInfo[playerid][pWatchOn]) { TextDrawShowForPlayer(playerid, TimeTD); } if(!PlayerInfo[playerid][pToggleHUD]) { PlayerTextDrawShow(playerid, PlayerInfo[playerid][pText][3]); PlayerTextDrawShow(playerid, PlayerInfo[playerid][pText][4]); } PlayerInfo[playerid][pToggleTextdraws] = 0; SendClientMessage(playerid, COLOR_AQUA, "Textdraws enabled. You will now see textdraws again."); } } else if(!strcmp(params, "ooc", true)) { if(!PlayerInfo[playerid][pToggleOOC]) { PlayerInfo[playerid][pToggleOOC] = 1; SendClientMessage(playerid, COLOR_AQUA, "OOC chat toggled. You will no longer see any messages in /o."); } else { PlayerInfo[playerid][pToggleOOC] = 0; SendClientMessage(playerid, COLOR_AQUA, "OOC chat enabled. You will now see messages in /o again."); } } else if(!strcmp(params, "global", true)) { if(!PlayerInfo[playerid][pToggleGlobal]) { PlayerInfo[playerid][pToggleGlobal] = 1; SendClientMessage(playerid, COLOR_AQUA, "Global chat toggled. You will no longer see any messages in /g."); } else { PlayerInfo[playerid][pToggleGlobal] = 0; SendClientMessage(playerid, COLOR_AQUA, "Global chat enabled. You can now speak to other players in /g."); } } else if(!strcmp(params, "phone", true)) { if(!PlayerInfo[playerid][pTogglePhone]) { if(PlayerInfo[playerid][pCallLine] != INVALID_PLAYER_ID) { return SendClientMessage(playerid, COLOR_GREY, "You can't do this while in a call."); } PlayerInfo[playerid][pTogglePhone] = 1; SendClientMessage(playerid, COLOR_AQUA, "Phone toggled. You will no longer receive calls or texts."); } else { PlayerInfo[playerid][pTogglePhone] = 0; SendClientMessage(playerid, COLOR_AQUA, "Phone enabled. You can now receive calls and texts again."); } } else if(!strcmp(params, "admin", true)) { if(!PlayerInfo[playerid][pAdmin]) { return SendClientMessage(playerid, COLOR_GREY, "You are not an admin and therefore cannot toggle this feature."); } if(!PlayerInfo[playerid][pToggleAdmin]) { PlayerInfo[playerid][pToggleAdmin] = 1; SendClientMessage(playerid, COLOR_AQUA, "Admin chat toggled. You will no longer see any messages in admin chat."); } else { PlayerInfo[playerid][pToggleAdmin] = 0; SendClientMessage(playerid, COLOR_AQUA, "Admin chat enabled. You will now see messages in admin chat again."); } } else if(!strcmp(params, "helper", true)) { if(!PlayerInfo[playerid][pHelper]) { return SendClientMessage(playerid, COLOR_GREY, "You are not a helper and therefore cannot toggle this feature."); } if(!PlayerInfo[playerid][pToggleHelper]) { PlayerInfo[playerid][pToggleHelper] = 1; SendClientMessage(playerid, COLOR_AQUA, "Helper chat toggled. You will no longer see any messages in helper chat."); } else { PlayerInfo[playerid][pToggleHelper] = 0; SendClientMessage(playerid, COLOR_AQUA, "Helper chat enabled. You will now see messages in helper chat again."); } } else if(!strcmp(params, "newbie", true)) { if(!PlayerInfo[playerid][pToggleNewbie]) { PlayerInfo[playerid][pToggleNewbie] = 1; SendClientMessage(playerid, COLOR_AQUA, "Newbie chat toggled. You will no longer see any messages in newbie chat."); } else { PlayerInfo[playerid][pToggleNewbie] = 0; SendClientMessage(playerid, COLOR_AQUA, "Newbie chat enabled. You will now see messages in newbie chat again."); } } else if(!strcmp(params, "walkietalkie", true)) { if(!PlayerInfo[playerid][pWalkieTalkie]) { return SendClientMessage(playerid, COLOR_GREY, "You don't have a walkie talkie."); } if(!PlayerInfo[playerid][pToggleWT]) { PlayerInfo[playerid][pToggleWT] = 1; SendClientMessage(playerid, COLOR_AQUA, "Walkie talkie toggled. You will no longer receive any messages on your walkie talkie."); } else { PlayerInfo[playerid][pToggleWT] = 0; SendClientMessage(playerid, COLOR_AQUA, "Walkie talkie enabled. You will now receive messages on your walkie talkie again."); } } else if(!strcmp(params, "radio", true)) { if(PlayerInfo[playerid][pFaction] == -1) { return SendClientMessage(playerid, COLOR_GREY, "You are not apart of a faction and therefore can't toggle your radio."); } if(!PlayerInfo[playerid][pToggleRadio]) { PlayerInfo[playerid][pToggleRadio] = 1; SendClientMessage(playerid, COLOR_AQUA, "Radio chat toggled. You will no longer receive any messages on your radio."); } else { PlayerInfo[playerid][pToggleRadio] = 0; SendClientMessage(playerid, COLOR_AQUA, "Radio chat enabled. You will now receive messages on your radio again."); } } else if(!strcmp(params, "streams", true)) { if(!PlayerInfo[playerid][pToggleMusic]) { PlayerInfo[playerid][pToggleMusic] = 1; StopAudioStreamForPlayer(playerid); SendClientMessage(playerid, COLOR_AQUA, "Music streams toggled. You will no longer hear any music played locally & globally."); } else { PlayerInfo[playerid][pToggleMusic] = 0; SendClientMessage(playerid, COLOR_AQUA, "Music streams enabled. You will now hear music played locally & globally again."); } } else if(!strcmp(params, "vip", true)) { if(!PlayerInfo[playerid][pVIPPackage]) { return SendClientMessage(playerid, COLOR_GREY, "You are not a VIP member and therefore cannot toggle this feature."); } if(!PlayerInfo[playerid][pToggleVIP]) { PlayerInfo[playerid][pToggleVIP] = 1; SendClientMessage(playerid, COLOR_AQUA, "VIP chat toggled. You will no longer see any messages in VIP chat."); } else { PlayerInfo[playerid][pToggleVIP] = 0; SendClientMessage(playerid, COLOR_AQUA, "VIP chat enabled. You will now see messages in VIP chat again."); } } else if(!strcmp(params, "faction", true)) { if(PlayerInfo[playerid][pFaction] == -1) { return SendClientMessage(playerid, COLOR_GREY, "You are not apart of a faction and therefore can't toggle this chat."); } if(!PlayerInfo[playerid][pToggleFaction]) { PlayerInfo[playerid][pToggleFaction] = 1; SendClientMessage(playerid, COLOR_AQUA, "Faction chat toggled. You will no longer see any messages in faction chat."); } else { PlayerInfo[playerid][pToggleFaction] = 0; SendClientMessage(playerid, COLOR_AQUA, "Faction chat enabled. You will now see messages in faction chat again."); } } else if(!strcmp(params, "gang", true)) { if(PlayerInfo[playerid][pGang] == -1) { return SendClientMessage(playerid, COLOR_GREY, "You are not a gang member and therefore can't toggle this chat."); } if(!PlayerInfo[playerid][pToggleGang]) { PlayerInfo[playerid][pToggleGang] = 1; SendClientMessage(playerid, COLOR_AQUA, "Gang chat toggled. You will no longer see any messages in gang chat."); } else { PlayerInfo[playerid][pToggleGang] = 0; SendClientMessage(playerid, COLOR_AQUA, "Gang chat enabled. You will now see messages in gang chat again."); } } else if(!strcmp(params, "news", true)) { if(!PlayerInfo[playerid][pToggleNews]) { PlayerInfo[playerid][pToggleNews] = 1; SendClientMessage(playerid, COLOR_AQUA, "News chat toggled. You will no longer see any news broadcasts."); } else { PlayerInfo[playerid][pToggleNews] = 0; SendClientMessage(playerid, COLOR_AQUA, "News chat enabled. You will now see news broadcasts again."); } } else if(!strcmp(params, "lands", true)) { callcmd::lands(playerid, "\1"); } else if(!strcmp(params, "whisper", true)) { if(PlayerInfo[playerid][pToggleWhisper] == 0) { PlayerInfo[playerid][pToggleWhisper] = 1; SendClientMessage(playerid, COLOR_AQUA, "Whisper chat disabled. You have blocked all incoming whispers."); } else { PlayerInfo[playerid][pToggleWhisper] = 0; SendClientMessage(playerid, COLOR_AQUA, "Whisper chat enabled. You will now receive whisper messages again."); } } else if(!strcmp(params, "spawncam", true)) { if(!PlayerInfo[playerid][pToggleCam]) { PlayerInfo[playerid][pToggleCam] = 1; SendClientMessage(playerid, COLOR_AQUA, "Spawn camera toggled. You will no longer see the camera effects upon spawning."); } else { PlayerInfo[playerid][pToggleCam] = 0; SendClientMessage(playerid, COLOR_AQUA, "Spawn camera enabled. You will now see the camera effects when you spawn again."); } } else if(!strcmp(params, "hud", true)) { if(!PlayerInfo[playerid][pToggleHUD]) { PlayerInfo[playerid][pToggleHUD] = 1; SendClientMessage(playerid, COLOR_AQUA, "HUD toggled. You will no longer see your health & armor indicators."); PlayerTextDrawHide(playerid, PlayerInfo[playerid][pText][3]); PlayerTextDrawHide(playerid, PlayerInfo[playerid][pText][4]); PlayerTextDrawHide(playerid, PlayerInfo[playerid][pText][5]); } else { PlayerInfo[playerid][pToggleHUD] = 0; SendClientMessage(playerid, COLOR_AQUA, "HUD enabled. You will now see your health & armor indicators again."); PlayerTextDrawShow(playerid, PlayerInfo[playerid][pText][3]); PlayerTextDrawShow(playerid, PlayerInfo[playerid][pText][4]); } } else if(!strcmp(params, "turfs", true)) { if(!PlayerInfo[playerid][pShowTurfs]) { ShowTurfsOnMap(playerid, true); SendClientMessage(playerid, COLOR_AQUA, "You will now see turfs on your mini-map."); } else { ShowTurfsOnMap(playerid, false); SendClientMessage(playerid, COLOR_AQUA, "You will no longer see any turfs on your mini-map."); } } else { SendClientMessage(playerid, COLOR_GREY3, "[Usage]: /(tog)gle [option]"); SendClientMessage(playerid, COLOR_GREY3, "List of options: Textdraws, OOC, Global, Phone, Newbie, WalkieTalkie, Radio, Streams, News, Lands"); SendClientMessage(playerid, COLOR_GREY3, "List of options: SpawnCam, HUD, Admin, Helper, VIP, Faction, Gang, Whisper, Turfs"); } return 1; } |