Well it's clear you didn't leave a parameter to determine what 'giveplayerid' is. Since the idea is to quickly throw a rock at someone, perhaps you should make it decrease a players health instead of kill him/her. Also decreasing the length of the command name would be useful for on-the-fly command typing for example, "/ro <id or partofname>" would be useful. You could increase its efficiency by getting the names of nearby players so the command typing player won't have to be as precise with the player's name. For example, Bob is within 50m of the command typing player, and Bobby is 100m away from the command typing player. If you get the names of the players that are closer, the command typing player could just type "/ro b" and since the only player who's name has a 'b' in it and is within 50m of the command typing player, the rock will be thrown at Bob.
Determining if Player is close enough to a player
pawn Код:
PlayerNearPlayer(player1,player2,Float:distance)
{
new Float:tmp[2][3];
GetPlayerPos(player1,tmp[0][0],tmp[0][1],tmp[0][2]);
GetPlayerPos(player2,tmp[1][0],tmp[1][1],tmp[1][2]);
return ((((tmp[1][0]-tmp[0][0])*(tmp[1][0]-tmp[0][0]))+((tmp[1][1]-tmp[0][1])*(tmp[1][1]-tmp[0][1]))+((tmp[1][2]-tmp[0][2])*(tmp[1][2]-tmp[0][2])))<distance*distance);
}
Use DCMD or strtok to determine what the command typing player has for the 'giveplayerid'