SA-MP Forums Archive
Sex Command Help - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Sex Command Help (/showthread.php?tid=163970)



Sex Command Help - silentmemory - 29.07.2010

Код:
	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?


Re: Sex Command Help - Fab10 - 29.07.2010

SetPlayerHealth(playa, 150);


Re: Sex Command Help - John_F - 29.07.2010

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.