Problems with CMD
#1

Ive been trying to build a CMD where u can Throw a Rock at a car driver within a 50m radius I have no idea how heres my cmd so far

Код:
  	if (!strcmp(cmd, "/rock", true))
   	new rands = random(2)+1;
 if(rands == 1) {
 SetPlayerHealth(giveplayerid, 0);
 }
 else
 {
SendClientMessage(playerid, COLOR_RED, "You Just Failed);
 }
 return 1;
 }
Reply
#2

Any errors with the command, when you compile?
Reply
#3

Post your errors, & what lines they're on.

If you really don't mind on releasing your script. Copy your script to Pastebin.
Reply
#4

I dont know how to make it using all the ids with range and stuff
Reply
#5

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'
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)