Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CMD:knockout(playerid, params[])
- {
- new giveplayerid;
- if(sscanf(params, "u", giveplayerid))
- return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /knockout [playerid/partofname]");
- if(IsPlayerConnected(giveplayerid))
- {
- if(PlayerInfo[playerid][pLevel] < 7)
- {
- SendClientMessage(playerid, COLOR_GREY, "You need to be atleast level 7 to use this command.");
- return 1;
- }
- if(KnockedDown[playerid] == 1)
- {
- SendClientMessage(playerid, COLOR_GREY, "Can't swing when you've been knocked out.");
- return 1;
- }
- if(PlayerBoxing[playerid] != 0)
- {
- SendClientMessage(playerid, COLOR_GREY, "You can't cheat and use that command while boxing.");
- return 1;
- }
- if(IsPlayerConnected(giveplayerid))
- {
- if(giveplayerid != INVALID_PLAYER_ID)
- {
- if (ProxDetectorS(1.0, playerid, giveplayerid))
- {
- if(KnockedDown[giveplayerid] != 1)
- {
- if(giveplayerid == playerid)
- {
- SendClientMessage(playerid, COLOR_GREY, " You can not swing at yourself.");
- return 1;
- }
- if(IsPlayerInAnyVehicle(giveplayerid))
- {
- return 1;
- }
- new playername[MAX_PLAYER_NAME];
- new sendername[MAX_PLAYER_NAME];
- GetPlayerName(playerid, playername, sizeof(playername));
- new rands = random(2)+1;
- new string[128]
- format(string, sizeof(string), "* %s swings at %s and tries to knock him out.", sendername, giveplayername);
- ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
- ApplyAnimation(playerid,"FIGHT_D","FightD_3",4.0,0,1,1,0,0);
- if(rands == 1)
- {
- TogglePlayerControllable(giveplayerid, 0);
- ApplyAnimation(giveplayerid, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0);
- SetTimerEx("ClearKnock", 20000, false, "i", giveplayerid);
- KnockedDown[giveplayerid] = 1;
- format(string, sizeof(string), "* %s succeeds to knock him down.", sendername);
- ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
- }
- else
- {
- format(string, sizeof(string), "* %s misses the swing and fails to knock him out.", sendername);
- ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
- }
- return 1;
- }
- else
- {
- SendClientMessage(playerid, COLOR_GREY, "Player is knocked down already.");
- }
- }
- else
- {
- SendClientMessage(playerid, COLOR_GREY, "Player is not near you.");
- }
- }
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment