Trying To Add Another Reserved Car
#1

Well, I made a reserved car script, and I wanted to know how I would go at adding another one.

Код:
// This is a comment
// uncomment the line below if you want to write a filterscript
#define FILTERSCRIPT
#define COLOR_RED 0xAA3333AA

#include <a_samp>

#if defined FILTERSCRIPT

new Tyler;

public OnFilterScriptInit()
{
	Tyler = AddStaticVehicle(562,-1959.1219,288.1400,35.1337,89.6646,145,145);
        AddVehicleComponent(Tyler, 1036);
	AddVehicleComponent(Tyler, 1040);
	AddVehicleComponent(Tyler, 1034);
	AddVehicleComponent(Tyler, 1172);
	AddVehicleComponent(Tyler, 1149);
	AddVehicleComponent(Tyler, 1035);
	AddVehicleComponent(Tyler, 1146);
	AddVehicleComponent(Tyler, 1079);
	return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
  new PlayerName[24];
  GetPlayerName(playerid, PlayerName, sizeof(PlayerName));

  if(newstate == PLAYER_STATE_DRIVER)
  {
   new Vehicle = GetPlayerVehicleID(playerid);
   if(Vehicle == Tyler)
   {
     if(strcmp(PlayerName,"Tyler[DGZ]",true))
     {
      RemovePlayerFromVehicle(playerid);
      SendClientMessage(playerid, 0xAA3333AA, "This car is reserved for: Tyler[DGZ]");
     }
   }
  }
  return 1;
}

public OnVehicleSpawn(vehicleid)
{
	AddVehicleComponent(Tyler, 1036);
	AddVehicleComponent(Tyler, 1040);
	AddVehicleComponent(Tyler, 1034);
	AddVehicleComponent(Tyler, 1172);
	AddVehicleComponent(Tyler, 1149);
	AddVehicleComponent(Tyler, 1035);
	AddVehicleComponent(Tyler, 1146);
	AddVehicleComponent(Tyler, 1079);
	}
#endif
Reply
#2

Easy
pawn Код:
new PlayerNoob;
PlayerNoob = AddStaticVehicle(562,-1959.1219,288.1400,35.1337,89.6646,145,145);
   if(Vehicle == PlayerNoob)
   {
        if(strcmp(PlayerName,"PlayerNoob",true))
       {
           RemovePlayerFromVehicle(playerid);
           SendClientMessage(playerid, 0xAA3333AA, "This car is reserved for: PlayerNoob");
       }
   }
Reply
#3

Appreciate it, I'm somewhat new to scripting as you can tell. >.<
Reply
#4

Got these errors:
C:\Users\tyler\Desktop\SERVER\filterscripts\reserv edcar.pwn(59) : error 010: invalid function or declaration
C:\Users\tyler\Desktop\SERVER\filterscripts\reserv edcar.pwn(60) : error 010: invalid function or declaration
C:\Users\tyler\Desktop\SERVER\filterscripts\reserv edcar.pwn(62) : error 010: invalid function or declaration
C:\Users\tyler\Desktop\SERVER\filterscripts\reserv edcar.pwn(70) : warning 203: symbol is never used: "Zrcar"
Reply
#5

Compiled and Works

pawn Код:
// This is a comment
// uncomment the line below if you want to write a filterscript
#define FILTERSCRIPT
#define COLOR_RED 0xAA3333AA

#include <a_samp>

new Tyler;
new PlayerNoob;

public OnFilterScriptInit()
{
    Tyler = AddStaticVehicle(562,-1959.1219,288.1400,35.1337,89.6646,145,145);
    PlayerNoob = AddStaticVehicle(562,-1959.1219,288.1400,35.1337,89.6646,145,145);
    AddVehicleComponent(Tyler, 1036);
    AddVehicleComponent(Tyler, 1040);
    AddVehicleComponent(Tyler, 1034);
    AddVehicleComponent(Tyler, 1172);
    AddVehicleComponent(Tyler, 1149);
    AddVehicleComponent(Tyler, 1035);
    AddVehicleComponent(Tyler, 1146);
    AddVehicleComponent(Tyler, 1079);
    return 1;
}


public OnPlayerStateChange(playerid, newstate, oldstate)
{
    new PlayerName[24];
    GetPlayerName(playerid, PlayerName, sizeof(PlayerName));

    if(newstate == PLAYER_STATE_DRIVER) {
        new Vehicle = GetPlayerVehicleID(playerid);
        if(Vehicle == Tyler) {
            if(strcmp(PlayerName,"Tyler[DGZ]",true)) {
                RemovePlayerFromVehicle(playerid);
                SendClientMessage(playerid, 0xAA3333AA, "This car is reserved for: Tyler[DGZ]");
            }
        }
        if(Vehicle == PlayerNoob) {
            if(strcmp(PlayerName,"PlayerNoob",true)) {
                RemovePlayerFromVehicle(playerid);
                SendClientMessage(playerid, 0xAA3333AA, "This car is reserved for: PlayerNoob");
            }
        }
    }
    return 1;
}


public OnVehicleSpawn(vehicleid)
{
    AddVehicleComponent(Tyler, 1036);
    AddVehicleComponent(Tyler, 1040);
    AddVehicleComponent(Tyler, 1034);
    AddVehicleComponent(Tyler, 1172);
    AddVehicleComponent(Tyler, 1149);
    AddVehicleComponent(Tyler, 1035);
    AddVehicleComponent(Tyler, 1146);
    AddVehicleComponent(Tyler, 1079);
}
Reply
#6

Код:
// This is a comment
// uncomment the line below if you want to write a filterscript
#define FILTERSCRIPT
#define COLOR_RED 0xAA3333AA

#include <a_samp>

#if defined FILTERSCRIPT

new Tyler;

public OnFilterScriptInit()
{
	Tyler = AddStaticVehicle(562,-1959.1219,288.1400,35.1337,89.6646,145,145);
    AddVehicleComponent(Tyler, 1036);
	AddVehicleComponent(Tyler, 1040);
	AddVehicleComponent(Tyler, 1034);
	AddVehicleComponent(Tyler, 1172);
	AddVehicleComponent(Tyler, 1149);
	AddVehicleComponent(Tyler, 1035);
	AddVehicleComponent(Tyler, 1146);
	AddVehicleComponent(Tyler, 1079);
	return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
  new PlayerName[24];
  GetPlayerName(playerid, PlayerName, sizeof(PlayerName));

  if(newstate == PLAYER_STATE_DRIVER)
  {
   new Vehicle = GetPlayerVehicleID(playerid);
   if(Vehicle == Tyler)
   {
     if(strcmp(PlayerName,"Tyler[DGZ]",true))
     {
      RemovePlayerFromVehicle(playerid);
      SendClientMessage(playerid, 0xAA3333AA, "This car is reserved for: Tyler[DGZ]");
     }
   }
  }
  return 1;
}

public OnVehicleSpawn(vehicleid)
{
	AddVehicleComponent(Tyler, 1036);
	AddVehicleComponent(Tyler, 1040);
	AddVehicleComponent(Tyler, 1034);
	AddVehicleComponent(Tyler, 1172);
	AddVehicleComponent(Tyler, 1149);
	AddVehicleComponent(Tyler, 1035);
	AddVehicleComponent(Tyler, 1146);
	AddVehicleComponent(Tyler, 1079);
	}
// Zr's Car
new PlayerNoob;
PlayerNoob = AddStaticVehicle(562,-1959.1219,288.1400,35.1337,89.6646,145,145);
   if(Vehicle == PlayerNoob)
   {
        if(strcmp(PlayerName,"PlayerNoob",true))
       {
           RemovePlayerFromVehicle(playerid);
           SendClientMessage(playerid, 0xAA3333AA, "This car is reserved for: PlayerNoob");
       }
   }
#endif
Reply
#7

cool post man.. helps me

btw its friez :d
Reply
#8

where do i put these codes ? on serverffs
Reply
#9

Quote:
Originally Posted by Twix[KDZ]
Посмотреть сообщение
where do i put these codes ? on serverffs
Wow - are you serious? I highly suggest you to read some tutorials how you install your server.
Reply
#10

OMG!!! First compile the script then upload amx in filterscripts folder of serverffs and add the script name in server.cfg filterscripts line
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)