04.09.2016, 15:11
I tried to make MMB for cops to arrest, so basically you don't need to write anything just click MMB and they arrest the nearest person.
But yeah it didn't work, so maybe someone can help me out with this and get it work?
My arrest command:
Ill rep who helps me out.
Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) { if(newkeys == KEY_LOOK_BEHIND) { COMMAND_arrest(playerid, (GetClosestPlayerID); return 1; }
My arrest command:
Код:
COMMAND:arrest(playerid, params[]) { new otherID, msg[512]; if(sscanf(params, "u", otherID)) { Usage(playerid, "arrest <playerid>"); } else { if(inTied(playerid)) { if(Player[playerid][english]) Server(playerid, "You can't use this command while tied."); else Server(playerid, "Kamu tidak bisa menggunakan perintah ini ketika di ikat."); return 1; } if(IsPlayerInAnyVehicle(playerid)) { if(Player[playerid][english]) Server(playerid, "You can't do this command while in vehicle."); else Server(playerid, "Kamu tidak bisa menggunakan perintah ini ketika di dalam kendaraan."); return 1; } if(IsPlayerInAnyVehicle(otherID)) { if(Player[playerid][english]) Server(playerid, "That player is in vehicle."); else Server(playerid, "Player itu sedang di dalam kendaraan."); return 1; } if(inJail(playerid)) { if(Player[playerid][english]) Server(playerid, "You can't use this command while jailed."); else Server(playerid, "Kamu tidak bisa menggunakan perintah ini ketika di penjara."); return 1; } if(!isLEO(playerid)) { if(Player[playerid][english]) Server(playerid, "This command only for LEO classes."); else Server(playerid, "Perintah ini hanya untuk LEO."); return 1; } if(isMe(playerid, otherID)) { if(Player[playerid][english]) Server(playerid, "You can't use this command to yourself."); else Server(playerid, "Kamu tidak bisa menggunakan perintah ini ke dirimu sendiri."); return 1; } if(!isConnected(otherID)) { if(Player[playerid][english]) Server(playerid, "That player isn't logged in!."); else Server(playerid, "Player tidak login."); return 1; } if(Player[otherID][playerWanted] < 6) { if(Player[playerid][english]) Server(playerid, "That player does not have a high enough wanted level."); else Server(playerid, "Player itu bukan kriminal."); return 1; } if(isCuffed(otherID)) { if(GetDistanceBetweenPlayers(playerid, otherID) < 5.0) { new time, total; time = Player[otherID][playerWanted] * 5; total = Player[otherID][playerWanted] * 150; Player[otherID][jailTime] = time; Player[playerid][playerArrest]++; switch(Player[playerid][playerArrest]) { case 1: { if(Player[playerid][english]) showAchievements(playerid, "Great, it's first time you arrested criminal", 1000); else showAchievements(playerid, "Hebat, kamu telah menangkap kriminal pertamamu", 1000); } case 100: { if(Player[playerid][english]) showAchievements(playerid, "You're a great cop, you've arrested 100 criminals", 3000); else showAchievements(playerid, "Kamu polisi hebat, kamu telah menangkap 100 kriminal", 3000); } case 500: { if(Player[playerid][english]) showAchievements(playerid, "Nice, you've arrested 500 criminals", 5000); else showAchievements(playerid, "Hebat, kamu telah menangkap 500 kriminal", 5000); } case 1000: { if(Player[playerid][english]) showAchievements(playerid, "Good Job General, you've arrested 1000 criminals", 50000); else showAchievements(playerid, "Habat Jenderal, kamu telah menangkap 1000 kriminal", 50000); } } if(isTazed(otherID)) { tazed(otherID); } format(msg, sizeof(msg), CHAT_YELLOW"%s"CHAT_WHITE" has been arrested by "CHAT_YELLOW"%s"CHAT_WHITE" for"CHAT_YELLOW" %d"CHAT_WHITE" seconds.", GetName(otherID), GetName(playerid), time); foreach(new i :Player) { Server(i, msg); } if(Player[playerid][english]) format(msg, sizeof(msg), CHAT_WHITE"You earnt "CHAT_YELLOW"$%s"CHAT_WHITE" for arresting"CHAT_YELLOW" %s"CHAT_WHITE".", FormatNumber(total), GetName(otherID)); else format(msg, sizeof(msg), CHAT_WHITE"Kamu mendapatkan "CHAT_YELLOW"$%s"CHAT_WHITE" karena menangkap"CHAT_YELLOW" %s"CHAT_WHITE".", FormatNumber(total), GetName(otherID)); Info(playerid, msg); SetPlayerCuffed(otherID, false); Player[otherID][cuffed] = false; jail(otherID); giveXP(playerid, 10); giveScore(playerid, 3); } else { if(Player[playerid][english]) Server(playerid, "You're not near that player."); else Server(playerid, "Kamu tidak dekat dengan player itu."); } } else { if(Player[playerid][english]) Server(playerid, "That player is not cuffed."); else Server(playerid, "Kamu harus memborgol player itu terlebih dahulu."); } } return 1; }