kako opraviti zcmd komande ne rabote in game

Započeo ucenik1, Januar 26, 2024, 17:29:08 POSLE PODNE

prethodna tema - sledeća tema

0 članova i 1 gost pregledaju ovu temu.

kako opraviti zcmd komande ne rabote in game


[pawn]#define FILTERSCRIPT
#include <a_samp>
#include <zcmd>
#include <sscanf2>
native IsValidVehicle(vehicleid);

enum vehicle_data
{
  vehicle_plate[32],
  vehicle_engine,
  vehicle_lights,
  vehicle_alarm,
  vehicle_locked,
  vehicle_bonnet,
  vehicle_boot,
  vehicle_objective
}
new VehicleData[MAX_VEHICLES][vehicle_data];

stock IsVehicleBicycle(vehicleid)
{
if(GetVehicleModel(vehicleid)==381 || GetVehicleModel(vehicleid)==509 ||GetVehicleModel(vehicleid)==510)return 1;
return 0;
}

stock SetVehicleParamsForAll(vehicleid, objective, doorslocked)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
SetVehicleParamsForPlayer(vehicleid, i, objective, doorslocked);
}
return 1;
}

stock GetNearestVehicle(playerid)
{
for(new i = 0; i < MAX_VEHICLES; i++)
  {
   if(IsValidVehicle(i))
   {
   new float:pos[3];
   GetVehiclePos(i, pos[0],pos[1],pos[2]);
   if(IsPlayerInRangeOfPoint(playerid,5.0,pos[0],pos[1],pos[2]))return i;
   }
  }
return INVALID_VEHICLE_ID;
}
public OnFilterScriptInit()
{
for(new v = 0; v < MAX_VEHICLES; v++)
{
  VehicleData[v][vehicle_engine]=VEHICLE_PARAMS_OFF;
  VehicleData[v][vehicle_lights]=VEHICLE_PARAMS_OFF;
  VehicleData[v][vehicle_alarm]=VEHICLE_PARAMS_OFF;
  VehicleData[v][vehicle_locked]=VEHICLE_PARAMS_OFF;
  VehicleData[v][vehicle_bonnet]=VEHICLE_PARAMS_OFF;
  VehicleData[v][vehicle_boot]=VEHICLE_PARAMS_OFF;
  VehicleData[v][vehicle_objective]=VEHICLE_PARAMS_OFF;

  if(IsVehicleBicycle(v))
  {
  VehicleData[v][vehicle_engine]=VEHICLE_PARAMS_ON;
  }

  SetVehicleParamsEx(v,VehicleData[v][vehicle_engine],VehicleData[v][vehicle_lights],VehicleData[v][vehicle_alarm],VehicleData[v][vehicle_locked],VehicleData[v][vehicle_bonnet],VehicleData[v][vehicle_boot],VehicleData[v][vehicle_objective]);
  }
return 1;
}

public OnVehicleStreamIn(vehicleid,forplayerid)
{
SetVehicleParamsEx(vehicleid,VehicleData[vehicleid][vehicle_engine], VehicleData[vehicleid][vehicle_lights],VehicleData[vehicleid][vehicle_alarm],VehicleData[vehicleid][vehicle_locked],VehicleData[vehicleid][vehicle_bonnet],VehicleData[vehicleid][vehicle_boot],VehicleData[vehicleid][vehicle_objective]);
SetVehicleParamsForAll(vehicleid, VehicleData[vehicleid][vehicle_objective],VehicleData[vehicleid][vehicle_locked]);
}
CMD:engine(playerid,params[])
{
if(!IsPlayerInAnyVehicle(playerid) || GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, -1 ,"Only driver can start engine");

new vehicleid = GetPlayerVehicleID(playerid);

if(VehicleData[vehicleid][vehicle_engine] == VEHICLE_PARAMS_OFF)
{
   VehicleData[vehicleid][vehicle_engine] = VEHICLE_PARAMS_ON;
   SetVehicleParamsEx(vehicleid,VehicleData[vehicleid][vehicle_engine],VehicleData[vehicleid][vehicle_lights],VehicleData[vehicleid][vehicle_alarm],VehicleData[vehicleid][vehicle_locked],VehicleData[vehicleid][vehicle_bonnet],VehicleData[vehicleid][vehicle_boot],VehicleData[vehicleid][vehicle_objective]);
   return GameTextForPlayer(playerid,"~g~Engine: On", 3000, 5);
}
else
{
   VehicleData[vehicleid][vehicle_engine] = VEHICLE_PARAMS_OFF;
   SetVehicleParamsEx(vehicleid,VehicleData[vehicleid][vehicle_engine],VehicleData[vehicleid][vehicle_lights],VehicleData[vehicleid][vehicle_alarm],VehicleData[vehicleid][vehicle_locked],VehicleData[vehicleid][vehicle_bonnet],VehicleData[vehicleid][vehicle_boot],VehicleData[vehicleid][vehicle_objective]);
   GameTextForPlayer(playerid,"~r~Engine: Off", 3000, 5);
}
return 1;
}
CMD:lights(playerid,params[])
{
if(!IsPlayerInAnyVehicle(playerid) || GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, -1 ,"Only driver can turn on lights");

new vehicleid = GetPlayerVehicleID(playerid);

if(VehicleData[vehicleid][vehicle_lights] == VEHICLE_PARAMS_OFF)
{
   VehicleData[vehicleid][vehicle_lights] = VEHICLE_PARAMS_ON;
   SetVehicleParamsEx(vehicleid,VehicleData[vehicleid][vehicle_engine],VehicleData[vehicleid][vehicle_lights],VehicleData[vehicleid][vehicle_alarm],VehicleData[vehicleid][vehicle_locked],VehicleData[vehicleid][vehicle_bonnet],VehicleData[vehicleid][vehicle_boot],VehicleData[vehicleid][vehicle_objective]);
   return GameTextForPlayer(playerid,"~g~Lights: On", 3000, 5);
}
else
{
   VehicleData[vehicleid][vehicle_lights] = VEHICLE_PARAMS_OFF;
   SetVehicleParamsEx(vehicleid,VehicleData[vehicleid][vehicle_engine],VehicleData[vehicleid][vehicle_lights],VehicleData[vehicleid][vehicle_alarm],VehicleData[vehicleid][vehicle_locked],VehicleData[vehicleid][vehicle_bonnet],VehicleData[vehicleid][vehicle_boot],VehicleData[vehicleid][vehicle_objective]);
   GameTextForPlayer(playerid,"~r~Lights: Off", 3000, 5);
}
return 1;
}
CMD:alarm(playerid,params[])
{
new vehicleid = GetNearestVehicle(playerid);
if(vehicleid == INVALID_VEHICLE_ID)return SendClientMessage(playerid, -1, "There are no vehicles nearby to toggle the alram for.");
if(VehicleData[vehicleid][vehicle_alarm] == VEHICLE_PARAMS_OFF)
{
   VehicleData[vehicleid][vehicle_alarm] = VEHICLE_PARAMS_ON;
   SetVehicleParamsEx(vehicleid,VehicleData[vehicleid][vehicle_engine],VehicleData[vehicleid][vehicle_lights],VehicleData[vehicleid][vehicle_alarm],VehicleData[vehicleid][vehicle_locked],VehicleData[vehicleid][vehicle_bonnet],VehicleData[vehicleid][vehicle_boot],VehicleData[vehicleid][vehicle_objective]);
   return GameTextForPlayer(playerid,"~g~Alarm: On", 3000, 5);
}
else
{
   VehicleData[vehicleid][vehicle_alarm] = VEHICLE_PARAMS_OFF;
   SetVehicleParamsEx(vehicleid,VehicleData[vehicleid][vehicle_engine],VehicleData[vehicleid][vehicle_lights],VehicleData[vehicleid][vehicle_alarm],VehicleData[vehicleid][vehicle_locked],VehicleData[vehicleid][vehicle_bonnet],VehicleData[vehicleid][vehicle_boot],VehicleData[vehicleid][vehicle_objective]);
   GameTextForPlayer(playerid,"~r~Alarm: Off", 3000, 5);
}
return 1;
}
CMD:bonnet(playerid,params[])
{
new vehicleid = GetNearestVehicle(playerid);
if(vehicleid == INVALID_VEHICLE_ID)return SendClientMessage(playerid, -1, "There are no vehicles nearby to open the bonet for");
if(VehicleData[vehicleid][vehicle_bonnet] == VEHICLE_PARAMS_OFF)
{
   VehicleData[vehicleid][vehicle_bonnet] = VEHICLE_PARAMS_ON;
   SetVehicleParamsEx(vehicleid,VehicleData[vehicleid][vehicle_engine],VehicleData[vehicleid][vehicle_lights],VehicleData[vehicleid][vehicle_alarm],VehicleData[vehicleid][vehicle_locked],VehicleData[vehicleid][vehicle_bonnet],VehicleData[vehicleid][vehicle_boot],VehicleData[vehicleid][vehicle_objective]);
   return GameTextForPlayer(playerid,"~g~Bonnet: Open", 3000, 5);
}
else
{
   VehicleData[vehicleid][vehicle_bonnet] = VEHICLE_PARAMS_OFF;
   SetVehicleParamsEx(vehicleid,VehicleData[vehicleid][vehicle_engine],VehicleData[vehicleid][vehicle_lights],VehicleData[vehicleid][vehicle_alarm],VehicleData[vehicleid][vehicle_locked],VehicleData[vehicleid][vehicle_bonnet],VehicleData[vehicleid][vehicle_boot],VehicleData[vehicleid][vehicle_objective]);
   GameTextForPlayer(playerid,"~r~Bonnet: Closed", 3000, 5);
}
return 1;
}
CMD:boot(playerid,params[])
{
new vehicleid = GetNearestVehicle(playerid);
if(vehicleid == INVALID_VEHICLE_ID)return SendClientMessage(playerid, -1, "There are no vehicles nearby to open the boot for");
if(VehicleData[vehicleid][vehicle_boot] == VEHICLE_PARAMS_OFF)
{
   VehicleData[vehicleid][vehicle_boot] = VEHICLE_PARAMS_ON;
   SetVehicleParamsEx(vehicleid,VehicleData[vehicleid][vehicle_engine],VehicleData[vehicleid][vehicle_lights],VehicleData[vehicleid][vehicle_alarm],VehicleData[vehicleid][vehicle_locked],VehicleData[vehicleid][vehicle_bonnet],VehicleData[vehicleid][vehicle_boot],VehicleData[vehicleid][vehicle_objective]);
   return GameTextForPlayer(playerid,"~g~boot: Open", 3000, 5);
}
else
{
   VehicleData[vehicleid][vehicle_boot] = VEHICLE_PARAMS_OFF;
   SetVehicleParamsEx(vehicleid,VehicleData[vehicleid][vehicle_engine],VehicleData[vehicleid][vehicle_lights],VehicleData[vehicleid][vehicle_alarm],VehicleData[vehicleid][vehicle_locked],VehicleData[vehicleid][vehicle_bonnet],VehicleData[vehicleid][vehicle_boot],VehicleData[vehicleid][vehicle_objective]);
   GameTextForPlayer(playerid,"~r~boot: Closed", 3000, 5);
}
return 1;
}
CMD:lock(playerid,params[])
{
new vehicleid = GetNearestVehicle(playerid);
if(vehicleid == INVALID_VEHICLE_ID)return SendClientMessage(playerid, -1, "There are no vehicles nearby to open the boot for");
if(VehicleData[vehicleid][vehicle_boot] == VEHICLE_PARAMS_OFF)
{
   VehicleData[vehicleid][vehicle_boot] = VEHICLE_PARAMS_ON;
   SetVehicleParamsEx(vehicleid,VehicleData[vehicleid][vehicle_engine],VehicleData[vehicleid][vehicle_lights],VehicleData[vehicleid][vehicle_alarm],VehicleData[vehicleid][vehicle_locked],VehicleData[vehicleid][vehicle_bonnet],VehicleData[vehicleid][vehicle_boot],VehicleData[vehicleid][vehicle_objective]);
   SetVehicleParamsForAll(vehicleid,VehicleData[vehicleid][vehicle_objective],VehicleData[vehicleid][vehicle_locked]);
   return GameTextForPlayer(playerid,"~g~Lock: Open", 3000, 5);
}
else
{
   VehicleData[vehicleid][vehicle_boot] = VEHICLE_PARAMS_OFF;
   SetVehicleParamsEx(vehicleid,VehicleData[vehicleid][vehicle_engine],VehicleData[vehicleid][vehicle_lights],VehicleData[vehicleid][vehicle_alarm],VehicleData[vehicleid][vehicle_locked],VehicleData[vehicleid][vehicle_bonnet],VehicleData[vehicleid][vehicle_boot],VehicleData[vehicleid][vehicle_objective]);
   SetVehicleParamsForAll(vehicleid,VehicleData[vehicleid][vehicle_objective],VehicleData[vehicleid][vehicle_locked]);
   GameTextForPlayer(playerid,"~r~Lock: Closed", 3000, 5);
}
return 1;
}[/pawn]

C:\Users\Jordan\Desktop\New folder\filterscripts\koli.pwn(42) : warning 213: tag mismatch
C:\Users\Jordan\Desktop\New folder\filterscripts\koli.pwn(42) : warning 213: tag mismatch
C:\Users\Jordan\Desktop\New folder\filterscripts\koli.pwn(42) : warning 213: tag mismatch
C:\Users\Jordan\Desktop\New folder\filterscripts\koli.pwn(43) : warning 213: tag mismatch
C:\Users\Jordan\Desktop\New folder\filterscripts\koli.pwn(43) : warning 213: tag mismatch
C:\Users\Jordan\Desktop\New folder\filterscripts\koli.pwn(43) : warning 213: tag mismatch
Pawn compiler 3.10.4           Copyright (c) 1997-2006, ITB CompuPhase

Header size:           1260 bytes
Code size:            19184 bytes
Data size:           334468 bytes
Stack/heap size:      16384 bytes; estimated max. usage=39 cells (156 bytes)
Total requirements:  371296 bytes

6 Warnings.