What is wrong with this?
#1

Ok so I am making this command and I am trying to make it so if the player types /kiss and the params are empty then it will send a client message to all "so and so kisses the air". Then if they specify an id in the params it will send a client message to all saying "so and so gives so and so a kiss."
Код:
dcmd_kiss(playerid, params[]) //aa
{
  new targetid = strval(params);
	if(!IsPlayerConnected(targetid))
	{
		SendClientMessage(playerid, COLOR_ERROR, "That player is not connected!");
	}
	if(GetDistanceBetweenPlayers(playerid, targetid) > DISTANCE_BETWEEN_PLAYERS)
	{
	  LoopingAnim(playerid, "KISSING", "Playa_Kiss_02", 3.0, 1, 1, 1, 1, 0); // Kissing
		format(myString, sizeof(myString), "%s (%i) kisses the air!", ReturnPlayerName(playerid));
		SendClientMessageToAll(YELLOW, myString);
		return 1;
	}
	if(GetDistanceBetweenPlayers(playerid, targetid) < DISTANCE_BETWEEN_PLAYERS)
	{
	  LoopingAnim(playerid, "KISSING", "Playa_Kiss_02", 3.0, 1, 1, 1, 1, 0); // Kissing
		format(myString, sizeof(myString), "%s (%i) gives %s (%i) a kiss!", ReturnPlayerName(playerid), targetName, targetid);
		SendClientMessageToAll(YELLOW, myString);
		return 1;
	}
	return 1;
}
Now this issue is when you just type /kiss it will say so and so(with the wrong id but correct name) kisses (long unknown sequence of code). I just want it so if they type /kiss it send the message to all about kissing air, if they type /kiss id and are in range then the client message will say "so and so gives so and so a kiss." Could someone please help me or correct what is wrong in my code. I would really appreciate it! Thanks in advance!
Reply
#2

Код:
format(myString, sizeof(myString), "%s (%i) kisses the air!", ReturnPlayerName(playerid), playerid);
Код:
format(myString, sizeof(myString), "%s (%i) gives %s (%i) a kiss!", ReturnPlayerName(playerid), playerid, targetName, targetid);
Reply
#3

Quote:
Originally Posted by Rav
Код:
format(myString, sizeof(myString), "%s (%i) kisses the air!", ReturnPlayerName(playerid), playerid);
Код:
format(myString, sizeof(myString), "%s (%i) gives %s (%i) a kiss!", ReturnPlayerName(playerid), playerid, targetName, targetid);
Ah I wasn't sure if I still needed to add in (,playerid) :/ but I guess you do :P Thanks a lot I will fix it and try it. Any issues, you know I will post :P! Other than that thank you very much!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)