/eject fail - ID 0 gets ejected too
#1

Код:
  if(!strcmp(cmd, "/eject", true))
	{
		new Float:pX,Float:pY,Float:pZ;
 		SendPlayerFormattedText(playerid,":::::::::::::::::::::::::::::::::::::::::::::::",0);
    SendClientMessage(playerid, COLOR_YELLOW	, "EMERGENCY EXIT activated");
    SendPlayerFormattedText(playerid,":::::::::::::::::::::::::::::::::::::::::::::::",0);
  	new name[MAX_PLAYER_NAME], string[128];
  	GetPlayerName(playerid, name, sizeof(name));
  	format(string, sizeof(string), "[!] %s used emergency exit (/eject) to outrun death. [!]", name );
		SendClientMessageToAll(RED, string);
		GetPlayerPos(giveplayerid,pX,pY,pZ);
	  SetPlayerPos(giveplayerid,pX,pY,pZ+10);
	  GivePlayerWeapon(playerid, 46, 1);
		return 1;
	}
Whats wrong here? If someone uses /eject, ID 0 gets slapped too..
Reply
#2

Is giveplayerid defined or is it set to the default of 0?
Reply
#3

Dont know..
Reply
#4

Quote:
Originally Posted by Mo3
Dont know..
What is the giveplayerid for in that script?
Reply
#5

I don't see 'giveplayerid' defined anywhere, so it means it's 0 and there is your problem.
Reply
#6

Use sscanf for this, really easy.
Reply
#7

Quote:
Originally Posted by Don Correlli
I don't see 'giveplayerid' defined anywhere, so it means it's 0 and there is your problem.
Yes, it's equal the default value of 0, so always player with ID 0 is ejected
Exchange it for playerid
Reply
#8

Quote:
Originally Posted by Sznupek
You have this variable in 12. line of your code
It's equal 0 (and always player with ID 0 is ejected), because probably, you haven't assigned any other value to it
Exchange it for playerid
And what in your post is different from mine? I said the same thing.

Quote:
Originally Posted by Sznupek
You have this variable in 12. line of your code
It's not defined as "other player id".
Reply
#9

He doesn't want /eject [id], he wants to eject themselves.

Change the 'giveplayerid' to 'playerid'.
Reply
#10

Quote:
Originally Posted by Don Correlli
Quote:
Originally Posted by Sznupek
You have this variable in 12. line of your code
It's equal 0 (and always player with ID 0 is ejected), because probably, you haven't assigned any other value to it
Exchange it for playerid
And what in your post is different from mine? I said the same thing.
I didn't read your post carefully and thought you're the founder of the therad
I noticed it after my reply, so I modified my first post to something sensible since I can't delete it, sorry
Yea?

Quote:
Originally Posted by Don Correlli
Quote:
Originally Posted by Sznupek
You have this variable in 12. line of your code
It's not defined as "other player id".
I've not written it
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)