SA-MP Forums Archive
Help Scripting Tire spikes - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help Scripting Tire spikes (/showthread.php?tid=142896)



Help Scripting Tire spikes - Luis- - 20.04.2010

i need help Scripting the tire spikes here are the errors

Код:
C:\Users\BooNii3\San andreas SAMP Servers\GTARP\pawno\include\Spikestrip.pwn(15) : warning 235: public function lacks forward declaration (symbol "OnPlayerUpdate")
C:\Users\BooNii3\San andreas SAMP Servers\GTARP\pawno\include\Spikestrip.pwn(19) : warning 217: loose indentation
C:\Users\BooNii3\San andreas SAMP Servers\GTARP\pawno\include\Spikestrip.pwn(29) : warning 217: loose indentation
C:\Users\BooNii3\San andreas SAMP Servers\GTARP\pawno\include\Spikestrip.pwn(29) : error 017: undefined symbol "GetVehicleDamageStatus"
C:\Users\BooNii3\San andreas SAMP Servers\GTARP\pawno\include\Spikestrip.pwn(31) : error 017: undefined symbol "UpdateVehicleDamageStatus"
C:\Users\BooNii3\San andreas SAMP Servers\GTARP\pawno\include\Spikestrip.pwn(32) : warning 217: loose indentation
C:\Users\BooNii3\San andreas SAMP Servers\GTARP\pawno\include\Spikestrip.pwn(28) : warning 204: symbol is assigned a value that is never used: "carid"
C:\Users\BooNii3\San andreas SAMP Servers\GTARP\pawno\include\Spikestrip.pwn(30) : warning 204: symbol is assigned a value that is never used: "tires"
C:\Users\BooNii3\San andreas SAMP Servers\GTARP\pawno\include\Spikestrip.pwn(27) : warning 203: symbol is never used: "lights"
C:\Users\BooNii3\San andreas SAMP Servers\GTARP\pawno\include\Spikestrip.pwn(27) : warning 203: symbol is never used: "doors"
C:\Users\BooNii3\San andreas SAMP Servers\GTARP\pawno\include\Spikestrip.pwn(27) : warning 203: symbol is never used: "panels"
C:\Users\BooNii3\San andreas SAMP Servers\GTARP\pawno\include\Spikestrip.pwn(27 -- 38) : warning 217: loose indentation
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
PLease help me it would be much apreciated.

Regards Luis


Re: Help Scripting Tire spikes - Luis- - 20.04.2010

EDIT:

Here is the script codes


Код:
#include <a_samp>
#include <SpikeStrip>

strtok(const string[], &index)
{
  new length = strlen(string);
  while ((index < length) && (string[index] <= ' '))
  {
   index++;
  }

  new offset = index;
  new result[20];
  while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
  {
   result[index - offset] = string[index];
   index++;
  }
  result[index - offset] = EOS;
  return result;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
  new cmd[256];
  new idx;
  cmd = strtok(cmdtext, idx);

  if (strcmp(cmd,"/createstrip",true) == 0)
  {
    new Float:plocx,Float:plocy,Float:plocz,Float:ploca;
    GetPlayerPos(playerid, plocx, plocy, plocz);
    GetPlayerFacingAngle(playerid,ploca);
    CreateStrip(plocx,plocy,plocz,ploca);
    return 1;
  }
  else if (strcmp(cmd,"/removestrip",true) == 0)
  {
    DeleteClosestStrip(playerid);
    return 1;
  }
  else if (strcmp(cmd,"/removeallstrip",true) == 0)
  {
    DeleteAllStrip();
    return 1;
  }
  
  return 0;
}
and... the Include

Код:
#include <a_samp>

#define MAX_SPIKESTRIPS 200

enum sInfo
{
  sCreated,
  Float:sX,
  Float:sY,
  Float:sZ,
  sObject,
};
new SpikeInfo[MAX_SPIKESTRIPS][sInfo];

public OnPlayerUpdate(playerid)
{
  if(!IsPlayerConnected(playerid)) return 0;

  if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
  {
    for(new i = 0; i < sizeof(SpikeInfo); i++)
     {
       if(IsPlayerInRangeOfPoint(playerid, 3.0, SpikeInfo[i][sX], SpikeInfo[i][sY], SpikeInfo[i][sZ]))
      {
         if(SpikeInfo[i][sCreated] == 1)
         {
           new panels, doors, lights, tires;
           new carid = GetPlayerVehicleID(playerid);
         GetVehicleDamageStatus(carid, panels, doors, lights, tires);
         tires = encode_tires(1, 1, 1, 1);
         UpdateVehicleDamageStatus(carid, panels, doors, lights, tires);
           return 0;
         }
       }
     }
   }

  return 1;
}

stock CreateStrip(Float:x,Float:y,Float:z,Float:Angle)
{
  for(new i = 0; i < sizeof(SpikeInfo); i++)
   {
     if(SpikeInfo[i][sCreated] == 0)
     {
      SpikeInfo[i][sCreated]=1;
      SpikeInfo[i][sX]=x;
      SpikeInfo[i][sY]=y;
      SpikeInfo[i][sZ]=z-0.7;
      SpikeInfo[i][sObject] = CreateObject(2899, x, y, z-0.9, 0, 0, Angle-90);
      return 1;
     }
   }
   return 0;
}

stock DeleteAllStrip()
{
  for(new i = 0; i < sizeof(SpikeInfo); i++)
   {
     if(SpikeInfo[i][sCreated] == 1)
     {
       SpikeInfo[i][sCreated]=0;
      SpikeInfo[i][sX]=0.0;
      SpikeInfo[i][sY]=0.0;
      SpikeInfo[i][sZ]=0.0;
      DestroyObject(SpikeInfo[i][sObject]);
     }
  }
  return 0;
}

stock DeleteClosestStrip(playerid)
{
  for(new i = 0; i < sizeof(SpikeInfo); i++)
   {
     if(IsPlayerInRangeOfPoint(playerid, 2.0, SpikeInfo[i][sX], SpikeInfo[i][sY], SpikeInfo[i][sZ]))
    {
       if(SpikeInfo[i][sCreated] == 1)
      {
        SpikeInfo[i][sCreated]=0;
        SpikeInfo[i][sX]=0.0;
        SpikeInfo[i][sY]=0.0;
        SpikeInfo[i][sZ]=0.0;
        DestroyObject(SpikeInfo[i][sObject]);
        return 1;
       }
     }
   }
  return 0;
}

encode_tires(tires1, tires2, tires3, tires4) {

  return tires1 | (tires2 << 1) | (tires3 << 2) | (tires4 << 3);

}



Re: Help Scripting Tire spikes - Luis- - 20.04.2010

Please help me


Re: Help Scripting Tire spikes - adsy - 20.04.2010

this cannot be in an include

public OnPlayerUpdate(playerid)

it must be in your script


Re: Help Scripting Tire spikes - dice7 - 20.04.2010

Update your server to 0.3a r7 and everything will work

http://forum.sa-mp.com/index.php?topic=161491.0


Re: Help Scripting Tire spikes - adsy - 20.04.2010

Quote:
Originally Posted by dice7
Update your server to 0.3a r7 and everything will work

http://forum.sa-mp.com/index.php?topic=161491.0
that wont help any pawno script that has undefined symbols in it and the very first line needs addressing because if there is any use at all in the main script of the onplayerupdate function then it wont work.


Re: Help Scripting Tire spikes - dice7 - 20.04.2010

Re-read the errors and the topic I linked