Unknown command /rape
#1

Код:
   if (strcmp(cmdtext, "/rape", true)==0)
    {
	 if ((GetTickCount() - gPlayerLastRape[playerid]) >= RAPE_MIN_WAIT) {
 		new victim = INVALID_PLAYER_ID;
		if (IsPlayerInAnyVehicle(playerid)) {
 			new vehicle = GetPlayerVehicleID(playerid);
	  	for(new i=0; i < MAX_PLAYERS; i++) {
   			if(i != playerid && IsPlayerConnected(i) && IsPlayerInAnyVehicle(i) && GetPlayerVehicleID(i) == vehicle) {
     			victim = i;
      		break;
				}
			}
		}
		else if (GetPlayerState(playerid) == PLAYER_STATE_ONFOOT) {
  			new Float:x1, Float:y1, Float:z1, Float:x2, Float:y2, Float:z2, Float:distance;
   		GetPlayerPos(playerid, x1, y1, z1);
  			for(new i=0; i < MAX_PLAYERS; i++) {
  			  if(i != playerid && IsPlayerConnected(i) && GetPlayerState(i) == PLAYER_STATE_ONFOOT) {
  			    GetPlayerPos(i, x2, y2, z2);
		    	distance = floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2)+floatpower(floatabs(floatsub(y2,y1)),2)+floatpower(floatabs(floatsub(z2,z1)),2));
	    		if(distance < RAPE_MAX_DISTANCE) {
   		  		victim = i;
    		  		break;
					}
				}
			}
		}
  if (victim != INVALID_PLAYER_ID) {
  new name[MAX_PLAYER_NAME], str[256];
  GetPlayerName(victim, name, MAX_PLAYER_NAME);
  new rand = random(100);
  gPlayerLastRape[playerid] = GetTickCount();
  if (rand <= RAPE_SUCCESS_PERCENTAGE) {
  GetPlayerName(playerid, name, MAX_PLAYER_NAME);
  format(str, sizeof(str), "%s (%d) has raped you and gave you %s", name, playerid,STI[rand][0]);
  SendClientMessage(victim, COLOR_RED, str);
  format(str, sizeof(str), "%s raped someone and gave him/her %s", name, victim, STI[rand][0]);
  SendClientMessageToAll(COLOR_RED,str);
  format(str, sizeof(str), "~y~Raped by %s.", name);
  GameTextForPlayer(victim, str, 3000, 3);
  new Float:health;
  GetPlayerHealth(victim, health);
  SetPlayerHealth(victim, health -10);
  GetPlayerName(victim, name, MAX_PLAYER_NAME);
  format(str, sizeof(str), "You have raped %s (%d) and infected him/her with %s", name, victim,STI[rand][0]);
  SendClientMessage(playerid, RAPE_SUCCESS, str);
  format(str, sizeof(str), "~y~Raped %s.", name);
  GameTextForPlayer(playerid, str, 3000, 3);
  SetPlayerScore(playerid, GetPlayerScore(playerid) +1);
  } else {
  GetPlayerName(playerid, name, MAX_PLAYER_NAME);
  format(str, sizeof(str), "%s (%d) has attempted to rape you but failed.", name, playerid);
  SendClientMessage(victim, RAPE_FAILURE, str);
  format(str, sizeof(str), "~y~%s attempted to rape you", name);
  GameTextForPlayer(victim, str, 3000, 3);
  GetPlayerName(victim, name, MAX_PLAYER_NAME);
  format(str, sizeof(str), "Your attempt to rape %s (%d) has failed.", name, victim);
  SendClientMessage(playerid, RAPE_FAILURE, str);
  format(str, sizeof(str), "~y~Attempt to rape %s failed", name);
  GameTextForPlayer(playerid, str, 3000, 3);
  }
  } else {
  SendClientMessage(playerid, RAPE_ERROR, "No players close enough to rape.");
  }
  } else {
  SendClientMessage(playerid, RAPE_ERROR, "Please wait before attempting to rape someone again.");
  }
     return true;
}
I did everything i could and still unknown command
Reply
#2

Your brackets are out of place.
Reply
#3

Quote:
Originally Posted by Jason_Borne420
Your brackets are out of place.
Not true. If he would missed a bracket then script won't be able to compile.

I suggest to you to add some debug-print-messages to the command (if you're going to read these posts again), that way you'll see where the problem appears.

And plus, he posted this on February 23, 2008, a bit late for your reply?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)