18.03.2009, 04:52
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."
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!
Код:
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; }