Sex Command Help
#1

Код:
	if(strcmp(cmd, "/sex", true) == 0)
	{
		tmp = strtok(cmdtext, idx);
		if(!strlen(tmp))
		{
			SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /sex [playerid/PartOfName]");
			return 1;
		}
		if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
		{
			SendClientMessage(playerid, COLOR_GRAD1, "   You have to be a passenger of a car, who else is gonna drive?");
			return 1;
		}
		new target = strval(tmp);
		if (target == playerid)
		{
			SendClientMessage(target, COLOR_GRAD1, "	You cant have sex with yourself... well you can but...");
			return 1;
		}
		new playa;
		new Float:shealth;
		if(IsStringAName(tmp))
		{
			playa = GetPlayerID(tmp);
		}
		else
		{
			playa = strval(tmp);
		}
		GetPlayerName(playa, giveplayer, sizeof(giveplayer));
		GetPlayerName(playerid, sendername, sizeof(sendername));
		if(GetPlayerState(playerid) == PLAYER_STATE_PASSENGER)
		{
			GetPlayerHealth(playa, shealth);
            SetPlayerHealth(playa, shealth+5);
			GiveMoney(playa, -20); // take money from
			GiveMoney(playerid, 20); // take money from hooker
			SendClientMessage(playa, COLOR_GRAD1, "	She's giving you so much pleasure you blow +5hp");
			SendClientMessage(playerid, COLOR_GRAD1, "	His dick feels good...");
	    	format(string, sizeof(string), "%s is having hot sex with %s", giveplayer, sendername);
			ProxDetector(20.0, playerid, string,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
		}
		return 1;
	}
How can I set either a team requirement for this command, distance requirement, or setting max HP as 150?
Reply
#2

SetPlayerHealth(playa, 150);
Reply
#3

Put a conditional right below the starting of the command,
if(player team == #)
then wrap everything in braces and below it all put:

else
{
sendclientmessage "You cannot use this command"
}

That's how you put a Team conditional on the command, you have to use the variable that is used to represent the players team though.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)