isnull problem
#1

PHP код:
CMD:up(playerid,params[])
{
  new 
TargetIDAmountFloat:X,Float:Y,Float:Z;
  if(!
IsPlayerAdmin(playerid)) return SendClientMessage(playerid,Red,"UnKnown Command! Type /cmds");
  if(
sscanf(params"ud",TargetID,Amount)) return SendClientMessage(playerid,Red,"Move up: /up <id>");
  if(!
IsPlayerConnected(TargetID)) return SendClientMessage(playerid,Red,"Player is not connected");
  if(!
IsPlayerInAnyVehicle(TargetID))
  {
    
GetPlayerPos(TargetID,X,Y,Z);
    
SetPlayerPos(TargetID,X,Y,Z+Amount);
  }
  else
  {
    
GetPlayerPos(TargetID,X,Y,Z);
    
SetVehiclePos(GetPlayerVehicleID(TargetID),X,Y,Z+Amount);
  }
  if(
isnull(Amount))
  {
    
GetPlayerPos(playerid,X,Y,Z);
    
SetPlayerPos(playerid,X,Y,Z+10);
  return 
1;

PHP код:
C:\Users\ituni_000\Desktop\Server\gamemodes\Untitled.pwn(318) : error 028invalid subscript (not an array or too many subscripts): "Amount"
C:\Users\ituni_000\Desktop\Server\gamemodes\Untitled.pwn(318) : error 029invalid expressionassumed zero
C
:\Users\ituni_000\Desktop\Server\gamemodes\Untitled.pwn(318) : error 028invalid subscript (not an array or too many subscripts): "Amount"
C:\Users\ituni_000\Desktop\Server\gamemodes\Untitled.pwn(318) : fatal error 107too many error messages on one line
Compilation aborted
.Pawn compiler 3.2.3664              Copyright (c1997-2006ITB CompuPhase
4 Errors

Reply
#2

1- I thought the 'isnull' function was just for strings? (You created it as an integer) - If so; try to change it for if (Amount == 0)
2- You miss a bracket after the last SetPlayerPos()
Reply
#3

isnull is only for strings tho lol...

What are you trying to do? Check if it's zero?
pawn Код:
if(Amount == 0)
Reply
#4

Runn3R, do you usually read comments? You might've overseen mine. But that's okay, because I'm a ninja when it's past 23:00.
Reply
#5

Quote:
Originally Posted by Kwarde
Посмотреть сообщение
Runn3R, do you usually read comments? You might've overseen mine. But that's okay, because I'm a ninja when it's past 23:00.
still dont work
Reply
#6

Код HTML:
CMD:up(playerid,params[]) 
{ 
  new TargetID, Amount, Float:X,Float:Y,Float:Z; 
  if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,Red,"UnKnown Command! Type /cmds"); 
  if(sscanf(params, "ud",TargetID,Amount)) return SendClientMessage(playerid,Red,"Move up: /up <id>"); 
  if(!IsPlayerConnected(TargetID)) return SendClientMessage(playerid,Red,"Player is not connected"); 
  if(!IsPlayerInAnyVehicle(TargetID)) 
  { 
    GetPlayerPos(TargetID,X,Y,Z); 
    SetPlayerPos(TargetID,X,Y,Z+Amount); 
  } 
  else 
  { 
    GetPlayerPos(TargetID,X,Y,Z); 
    SetVehiclePos(GetPlayerVehicleID(TargetID),X,Y,Z+Amount); 
  } 
  if(Amount == 0) 
  { 
    GetPlayerPos(playerid,X,Y,Z); 
    SetPlayerPos(playerid,X,Y,Z+10); 
   }
  return 1; 
}
Reply
#7

i said didnt work
Reply
#8

pawn Код:
CMD:up(playerid,params[])*
{*
**new*TargetID,*Amount,*Float:X,Float:Y,Float:Z;*
**if(!IsPlayerAdmin(playerid))*return*SendClientMessage(playerid,Red,"UnKnown*Command!*Type*/cmds");*
**if(sscanf(params,*"uI(10)",TargetID,Amount))*return*SendClientMessage(playerid,Red,"Move*up:*/up*<id>");*
**if(!IsPlayerConnected(TargetID))*return*SendClientMessage(playerid,Red,"Player*is*not*connected");*
**if(!IsPlayerInAnyVehicle(TargetID))*
**{*
****GetPlayerPos(TargetID,X,Y,Z);*
****SetPlayerPos(TargetID,X,Y,Z+Amount);*
**}*
**else*
**{*
****GetPlayerPos(TargetID,X,Y,Z);*
****SetVehiclePos(GetPlayerVehicleID(TargetID),X,Y,Z+Amount);*
   }
**return*1;*
}**
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)