SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Help Archive

 
 
Thread Tools Display Modes
Old 23/02/2008, 04:38 PM   #1
aroma
Little Clucker
 
Join Date: Feb 2008
Posts: 16
Reputation: 0
Default Unknown command /rape

Code:
   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
aroma is offline  
Old 27/08/2009, 11:58 PM   #2
Jason_Borne420
Big Clucker
 
Join Date: Feb 2008
Posts: 57
Reputation: 0
Default Re: Unknown command /rape

Your brackets are out of place.
Jason_Borne420 is offline  
Old 28/08/2009, 12:00 AM   #3
Correlli
Godfather
 
Correlli's Avatar
 
Join Date: May 2009
Location: Slovenia
Posts: 6,340
Reputation: 365
Default Re: Unknown command /rape

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?
Correlli is offline  
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Command Bugged] Each time i use /respawnallcars it says Unknown Command Rand_Omar Scripting Help 11 30/09/2012 01:35 AM
SERVER: Unknown Command when using a scripted command and it does execute! Moustafa Help Archive 6 11/06/2010 02:34 PM
Some problems at /rape command with "condoms" MaykoX Help Archive 0 15/03/2010 05:51 PM
rape command doesnt work[SOLVED] kman Help Archive 1 16/01/2010 08:41 PM


All times are GMT. The time now is 12:56 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.