Small Sscanf issue .. +REPP for help
#1

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




Код:
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;
}
Reply


Messages In This Thread
Small Sscanf issue .. +REPP for help - by DonWade - 29.12.2011, 19:19
Re: Small Sscanf issue .. +REPP for help - by DonWade - 30.12.2011, 13:52
Re: Small Sscanf issue .. +REPP for help - by HuSs3n - 30.12.2011, 15:26
Re: Small Sscanf issue .. +REPP for help - by [O.z]Caroline - 30.12.2011, 17:29
Re: Small Sscanf issue .. +REPP for help - by Dark_Kostas - 30.12.2011, 17:36
Re: Small Sscanf issue .. +REPP for help - by DonWade - 30.12.2011, 19:44
Re: Small Sscanf issue .. +REPP for help - by DonWade - 01.01.2012, 12:52
Re: Small Sscanf issue .. +REPP for help - by Babul - 01.01.2012, 13:19
Re: Small Sscanf issue .. +REPP for help - by DonWade - 01.01.2012, 14:01
Re: Small Sscanf issue .. +REPP for help - by Dark_Kostas - 01.01.2012, 14:32

Forum Jump:


Users browsing this thread: 1 Guest(s)