29.12.2011, 19:19
i have problem , heres command for rape , and its working , but i want to make that u can rape closest player to you , without entering id and it works fine when i put new ID = GetClosestPlayerToPlayer(playerid); instead new ID; but then i cant rape player using /rape id
Anyone have solution for this ??
Giving +repp for help
Anyone have solution for this ??
Giving +repp for help
Код:
dcmd_rape(playerid,params[]) { new string[128]; new ID; new Float:phealth; GetPlayerHealth(ID,phealth); if(sscanf(params, "u", ID)) { SendClientMessage(playerid,COLOR_RED,"USAGE: /rape (Player Name/ID)"); return 1; } if(IsSpawned[playerid] != 1) { SendClientMessage(playerid,COLOR_RED,"You must be alive and spawned in order to be able to use this command."); return 1; } if(!IsPlayerConnected(ID)) { format(string,sizeof(string),"The player ID (%d) is not connected to the server. You cannot rape them",ID); SendClientMessage(playerid,COLOR_RED,string); return 1; } if(gTeam[playerid] != CIVILIAN) { SendClientMessage(playerid,COLOR_RED,"Only Civilians can rape other players."); return 1; } if(GetDistanceBetweenPlayers(playerid,ID) > 4) { SendClientMessage(playerid,COLOR_RED,"Player is not in range."); return 1; } if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER || GetPlayerState(playerid) == PLAYER_STATE_PASSENGER) { SendClientMessage(playerid,COLOR_RED,"You cannot rape someone while in a vehicle. Exit the vehicle first."); return 1; } if(GetPlayerState(ID) == PLAYER_STATE_DRIVER || GetPlayerState(ID) == PLAYER_STATE_PASSENGER) { SendClientMessage(playerid,COLOR_RED,"You cannot rape someone while they are in a vehicle. Get them to exit the vehicle first."); return 1; } if(IsSpawned[ID] != 1) { format(string,sizeof(string),"%s(%d) is not spawned. You cannot rape dead people.",PlayerName(ID),ID); SendClientMessage(playerid,COLOR_RED,string); return 1; } if(HasRapedRecently[playerid] > 1) { SendClientMessage(playerid,COLOR_RED,"Please wait before raping someone again."); return 1; } HasRapedRecently[playerid] =15; SetPlayerScore(playerid, GetPlayerScore(playerid)+1); SetPlayerHealth(ID, phealth-5); format(string,sizeof(string),"%s (%d) has raped %s (%d).",PlayerName(playerid),playerid,PlayerName(ID),ID); SendClientMessageToAll(COLOR_ORANGE,string); return 1; }