SA-MP Forums Archive
isnull problem - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: isnull problem (/showthread.php?tid=546205)



isnull problem - BoU3A - 13.11.2014

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




Re: isnull problem - Kwarde - 13.11.2014

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()


Re: isnull problem - Runn3R - 13.11.2014

isnull is only for strings tho lol...

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



Re: isnull problem - Kwarde - 13.11.2014

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.


Re: isnull problem - BoU3A - 13.11.2014

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


Re: isnull problem - Runn3R - 13.11.2014

Код 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; 
}



Re: isnull problem - BoU3A - 13.11.2014

i said didnt work


Re: isnull problem - biker122 - 14.11.2014

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;*
}**