11.07.2015, 19:47
All i need is when a player uses one of these 2 commands,to stop them from using them for the next 5minutes or less so they cant exploit score and money.Tnx in advance who helps
Код:
// This command allows the player to call for assistance COMMAND:mehanicar(playerid, params[]) { if((GetTickCount() - Asisteri[playerid]) < 10){ return SendClientMessage(playerid, 0xFFFFFF, "[ANTI-SPAM]Nemozes koristit kommandu /mehanicar, moras malo sacekati"); } else{ Asisteri[playerid] = GetTickCount(); } // Setup local variables new bool:AssistOnline = false, Msg[128], Name[24]; // Send the command to all admins so they can see it SendAdminText(playerid, "/mehanicar", params); // Check if the player has logged in if (APlayerData[playerid][LoggedIn] == true) { // Get the player's name GetPlayerName(playerid, Name, sizeof(Name)); // Preset the Message that needs to be sent to assistance players format(Msg, 128, "{00FF00}Igrac {FFFF00}%s{00FF00} treba popravak, idi i pomogni mu", Name); // Check if there is at least one assistance player online for (new i; i < MAX_PLAYERS; i++) { // Check if this player is connected if (IsPlayerConnected(i)) { // Check if this player is assistance class if (APlayerData[i][PlayerClass] == ClassAssistance) { // Set the flag to indicate that at least one assistance player is online AssistOnline = true; // Send the assistance player a Message to inform him who needs assistance SendClientMessage(i, 0xFFFFFFFF, Msg); } } } // Check if there is at least one assistance player online if (AssistOnline == true) { // Set yourself as "AssistanceNeeded" APlayerData[playerid][AssistanceNeeded] = true; // Let the player know he called for assistance SendClientMessage(playerid, 0xFFFFFFFF, "{00FF00}Pozvao si mehanicara"); } else // No assistance is online { // Check if the player is the driver of a vehicle if (GetPlayerVehicleSeat(playerid) == 0) { // Fully repair the vehicle (damage value and bodywork) RepairVehicle(GetPlayerVehicleID(playerid)); // Also re-fuel the vehicle AVehicleData[GetPlayerVehicleID(playerid)][Fuel] = MaxFuel; // Let the player pay for the repairs and refuel (default $2000) RewardPlayer(playerid, -2000, 0); // Let the player know he spent $2000 for auto-repair because there were no assistance players online SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}Tvoje vozilo je napunjeno i popravljeno za $2000"); SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}jer trenutno nema mehanicara online"); } } } else return 0; // Let the server know that this was a valid command return 1; }
Код:
//MEDIC COMMAND:zivot(playerid, params[]) { if((GetTickCount() - Mediceri[playerid]) < 10){ return SendClientMessage(playerid, 0xFFFFFF, "[ANTI-SPAM]Kommandu /zivot mozes Komandat nakon nekog vremena"); } else{ Mediceri[playerid] = GetTickCount(); } // Setup local variables new bool:MedicOnline = false, Msg[128], Name[24]; // Send the command to all admins so they can see it SendAdminText(playerid, "/zivot", params); // Check if the player has logged in if (APlayerData[playerid][LoggedIn] == true) { // Get the player's name GetPlayerName(playerid, Name, sizeof(Name)); // Preset the Message that needs to be sent to assistance players format(Msg, 128, "{00FF00}Igrac {FFFF00}%s{00FF00} treba pomoc, idi i izlijeci ga", Name); // Check if there is at least one assistance player online for (new i; i < MAX_PLAYERS; i++) { // Check if this player is connected if (IsPlayerConnected(i)) { // Check if this player is assistance class if (APlayerData[i][PlayerClass] == ClassMedic) { // Set the flag to indicate that at least one assistance player is online MedicOnline = true; // Send the assistance player a Message to inform him who needs assistance SendClientMessage(i, 0xFFFFFFFF, Msg); } } } // Check if there is at least one assistance player online if (MedicOnline == true) { // Set yourself as "AssistanceNeeded" APlayerData[playerid][MedicNeeded] = true; // Let the player know he called for assistance SendClientMessage(playerid, 0xFFFFFFFF, "{00FF00}Pozvao si liječnika"); } else // No assistance is online { SetPlayerHealth(playerid, 100); SetPlayerDrunkLevel(playerid, 0); // Also re-fuel the vehicle RewardPlayer(playerid, -1000, 0); // Let the player know he spent $2000 for auto-repair because there were no assistance players online SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}Automatski si izliječen za $1000 jer nema niti jednog bolničara online"); } } else return 0;