Whats wrong with this code?
#1

Код:
  if(strcmp("/bankcmd", cmdtext, true, 10) == 0)
		{
		if (PlayerToPoint(2, playerid,2316.5947,-7.8318, 26.7422))
  		SendClientMessage(playerid,COLOR_LIGHTBLUE, "|______ Bank Commands ______|");
		SendClientMessage(playerid,COLOR_WHITE, "/withdraw to withdraw your money");
    SendClientMessage(playerid,COLOR_WHITE, "/deposit to deposit your money");
    SendClientMessage(playerid,COLOR_WHITE, "/bankstats to check your money");
    return 1;
 		}
    else
    {
    SendClientMessage(playerid, RED, "To use that command you must be in a bank!");
 }
Whats wrong with this code? i want it so when the player is at the bank icon they type /bankcmd then these commands show up, but on my server even if im not at the bank icon and i type /bankcmd it still shows the command...how do i fix this?
Reply
#2

edit
Код:
{ if (PlayerToPoint(2, playerid,2316.5947,-7.8318, 26.7422))
SendClientMessage
Код:
{ if (PlayerToPoint(2, playerid,2316.5947,-7.8318, 26.7422)){
SendClientMessage
Reply
#3

Quote:
Originally Posted by yezizhu
edit
Код:
{ if (PlayerToPoint(2, playerid,2316.5947,-7.8318, 26.7422))
SendClientMessage
Код:
{ if (PlayerToPoint(2, playerid,2316.5947,-7.8318, 26.7422)){
SendClientMessage
That did not work, I get a lot...I mean Alot of errors with that

Код:
C:\Documents and Settings\Anuj_2\Desktop\Icons\GTA Server files\Gamemodes\Copy of Anuj's Server\pawno\include\cps.inc(140) : warning 208: function with tag result used before definition, forcing reparse
C:\Documents and Settings\Anuj_2\Desktop\Icons\GTA Server files\Gamemodes\Copy of Anuj's Server\gamemodes\Script.Pwn(175) : error 004: function "SendPlayerFormattedText" is not implemented
C:\Documents and Settings\Anuj_2\Desktop\Icons\GTA Server files\Gamemodes\Copy of Anuj's Server\gamemodes\Script.Pwn(256) : error 017: undefined symbol "strtok"
C:\Documents and Settings\Anuj_2\Desktop\Icons\GTA Server files\Gamemodes\Copy of Anuj's Server\gamemodes\Script.Pwn(256) : error 033: array must be indexed (variable "cmd")
C:\Documents and Settings\Anuj_2\Desktop\Icons\GTA Server files\Gamemodes\Copy of Anuj's Server\gamemodes\Script.Pwn(271) : error 079: inconsistent return types (array & non-array)
C:\Documents and Settings\Anuj_2\Desktop\Icons\GTA Server files\Gamemodes\Copy of Anuj's Server\gamemodes\Script.Pwn(281) : error 079: inconsistent return types (array & non-array)
C:\Documents and Settings\Anuj_2\Desktop\Icons\GTA Server files\Gamemodes\Copy of Anuj's Server\gamemodes\Script.Pwn(291) : error 079: inconsistent return types (array & non-array)
C:\Documents and Settings\Anuj_2\Desktop\Icons\GTA Server files\Gamemodes\Copy of Anuj's Server\gamemodes\Script.Pwn(298) : error 079: inconsistent return types (array & non-array)
C:\Documents and Settings\Anuj_2\Desktop\Icons\GTA Server files\Gamemodes\Copy of Anuj's Server\gamemodes\Script.Pwn(304) : error 079: inconsistent return types (array & non-array)
C:\Documents and Settings\Anuj_2\Desktop\Icons\GTA Server files\Gamemodes\Copy of Anuj's Server\gamemodes\Script.Pwn(311) : error 079: inconsistent return types (array & non-array)
C:\Documents and Settings\Anuj_2\Desktop\Icons\GTA Server files\Gamemodes\Copy of Anuj's Server\gamemodes\Script.Pwn(318) : error 079: inconsistent return types (array & non-array)
C:\Documents and Settings\Anuj_2\Desktop\Icons\GTA Server files\Gamemodes\Copy of Anuj's Server\gamemodes\Script.Pwn(325) : error 079: inconsistent return types (array & non-array)
C:\Documents and Settings\Anuj_2\Desktop\Icons\GTA Server files\Gamemodes\Copy of Anuj's Server\gamemodes\Script.Pwn(332) : error 004: function "PlayerToPoint" is not implemented
C:\Documents and Settings\Anuj_2\Desktop\Icons\GTA Server files\Gamemodes\Copy of Anuj's Server\gamemodes\Script.Pwn(349) : error 079: inconsistent return types (array & non-array)
C:\Documents and Settings\Anuj_2\Desktop\Icons\GTA Server files\Gamemodes\Copy of Anuj's Server\gamemodes\Script.Pwn(365) : error 079: inconsistent return types (array & non-array)
C:\Documents and Settings\Anuj_2\Desktop\Icons\GTA Server files\Gamemodes\Copy of Anuj's Server\gamemodes\Script.Pwn(374) : error 079: inconsistent return types (array & non-array)
C:\Documents and Settings\Anuj_2\Desktop\Icons\GTA Server files\Gamemodes\Copy of Anuj's Server\gamemodes\Script.Pwn(383) : error 079: inconsistent return types (array & non-array)
C:\Documents and Settings\Anuj_2\Desktop\Icons\GTA Server files\Gamemodes\Copy of Anuj's Server\gamemodes\Script.Pwn(394) : error 079: inconsistent return types (array & non-array)
C:\Documents and Settings\Anuj_2\Desktop\Icons\GTA Server files\Gamemodes\Copy of Anuj's Server\gamemodes\Script.Pwn(405) : error 079: inconsistent return types (array & non-array)
C:\Documents and Settings\Anuj_2\Desktop\Icons\GTA Server files\Gamemodes\Copy of Anuj's Server\gamemodes\Script.Pwn(417) : error 079: inconsistent return types (array & non-array)
C:\Documents and Settings\Anuj_2\Desktop\Icons\GTA Server files\Gamemodes\Copy of Anuj's Server\gamemodes\Script.Pwn(428) : error 079: inconsistent return types (array & non-array)
C:\Documents and Settings\Anuj_2\Desktop\Icons\GTA Server files\Gamemodes\Copy of Anuj's Server\gamemodes\Script.Pwn(439) : error 079: inconsistent return types (array & non-array)
C:\Documents and Settings\Anuj_2\Desktop\Icons\GTA Server files\Gamemodes\Copy of Anuj's Server\gamemodes\Script.Pwn(451) : error 079: inconsistent return types (array & non-array)
C:\Documents and Settings\Anuj_2\Desktop\Icons\GTA Server files\Gamemodes\Copy of Anuj's Server\gamemodes\Script.Pwn(463) : error 079: inconsistent return types (array & non-array)
C:\Documents and Settings\Anuj_2\Desktop\Icons\GTA Server files\Gamemodes\Copy of Anuj's Server\gamemodes\Script.Pwn(470) : error 079: inconsistent return types (array & non-array)
C:\Documents and Settings\Anuj_2\Desktop\Icons\GTA Server files\Gamemodes\Copy of Anuj's Server\gamemodes\Script.Pwn(476) : error 079: inconsistent return types (array & non-array)
C:\Documents and Settings\Anuj_2\Desktop\Icons\GTA Server files\Gamemodes\Copy of Anuj's Server\gamemodes\Script.Pwn(490) : error 079: inconsistent return types (array & non-array)
Reply
#4

pawn Код:
if(strcmp("/bankcmd", cmdtext, true, 8) == 0)
  {
    if (PlayerToPoint(2, playerid,2316.5947,-7.8318, 26.7422))
    {
      SendClientMessage(playerid,COLOR_LIGHTBLUE, "|______ Bank Commands ______|");
      SendClientMessage(playerid,COLOR_WHITE, "/withdraw to withdraw your money");
      SendClientMessage(playerid,COLOR_WHITE, "/deposit to deposit your money");
      SendClientMessage(playerid,COLOR_WHITE, "/bankstats to check your money");
      return 1;
    }
    else
    {
      SendClientMessage(playerid, RED, "To use that command you must be in a bank!");
      return 1;
    }
  }
Reply
#5

Quote:
Originally Posted by ledzep
pawn Код:
if(strcmp("/bankcmd", cmdtext, true, 8) == 0)
  {
    if (PlayerToPoint(2, playerid,2316.5947,-7.8318, 26.7422))
    {
      SendClientMessage(playerid,COLOR_LIGHTBLUE, "|______ Bank Commands ______|");
      SendClientMessage(playerid,COLOR_WHITE, "/withdraw to withdraw your money");
      SendClientMessage(playerid,COLOR_WHITE, "/deposit to deposit your money");
      SendClientMessage(playerid,COLOR_WHITE, "/bankstats to check your money");
      return 1;
    }
    else
    {
      SendClientMessage(playerid, RED, "To use that command you must be in a bank!");
      return 1;
    }
  }

Thank you so much! it worked!!

One more question, Do you know how to make it so when a car enters a checkpoint, the player does not get teleported into the place? only if they get out of the vehicle they do?
Reply
#6

By default, checkpoints don't do anything. They just look pretty. So you have a piece of code that teleporting you places.
You'd have to post your code for us to fix that.
Reply
#7

Quote:
Originally Posted by ledzep
By default, checkpoints don't do anything. They just look pretty. So you have a piece of code that teleporting you places.
You'd have to post your code for us to fix that.
Here is one code that teleports me inside my bank location

Код:
cp3 = CreateCheckpoint(-1,2414.9792,1124.0551,10.8203,3.0,44.0);
I want it so, When a car goes over this checkpoint nothing happens, but if the player gets out then he gets teleported into the interior of my bank
Reply
#8

Learn the basic by checking how other scripts do it.

Код:
OnPlayerEnterCheckpoint(......
{
  if(!IsPlayerInAnyVehicle(......
  {
    // teleport him
  }
  return 1;
}
Reply
#9

Quote:
Originally Posted by [LSD
Rac3r ]
Learn the basic by checking how other scripts do it.

Код:
OnPlayerEnterCheckpoint(......
{
  if(!IsPlayerInAnyVehicle(......
  {
    // teleport him
  }
  return 1;
}
I don't want it so the player gets teleported...I want it so if the player is in a vehicle nothing happens. So any checkpoint he goes to in my script and if hes in a vehicle nothing happens
Reply
#10

Ummm. Yesh.

Код:
WhenThePlayerEntersTheCheckpoint( theplayer , theCPnumber )
{
  if ( ThePlayerIs_NOT_InAnyVehicle ( theplayer ))
  {
    SetPlayerPosition ( theplayer , 0.0 , 0.0 , 0.0 );
  }
  if ( ThePlayerIsInAnyVehicle ( theplayer ))
  {
    print("Do_Not_Teleport_The_Player");
   }
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)