This is a FILTERSCRIPT so you will need to add whatever you name this in pawn to your server.cfg
Its a vehicle spawner. it can be for rcon admins only for for everyone. i use it on my server. it works. you will need the vehicle id nuumbers in order to spawn.
Код:
/*
Vehicle spawn system with anti spam (v1.2) - By Kwarde
Link to topic: https://sampforum.blast.hk/showthread.ph...#pid879008 - More info there
You may re-release this script, but only if you keep this comment in the script.
If you remove it, you may not re-release it.
You may, off course just edit it. blabla.
- Kevin
*/
#include <a_samp>
#include <zcmd>
#undef MAX_PLAYERS
#define MAX_SLOTS 50 //Max players of your server. Changing it is recommended!
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_RED 0xFF0000AA
#define COLOR_GREEN 0x00FF00AA
#define COLOR_YELLOW 0xFFFF00AA
new bool:RconOnly = true,
VehicleSpawned[MAX_SLOTS],
bool:MessageGiven[MAX_SLOTS];
public OnFilterScriptInit()
{
for(new i = 0; i < MAX_SLOTS; i++){
if(VehicleSpawned[i] != -1){
DestroyVehicle(VehicleSpawned[i]);
VehicleSpawned[i] = (-1);
}
MessageGiven[i] = false;
}
print("Kwarde's Vehicle Spawn system LOADED");
return 1;
}
public OnFilterScriptExit()
{
for(new i = 0; i < MAX_SLOTS; i++){
if(VehicleSpawned[i] != -1){
DestroyVehicle(VehicleSpawned[i]);
VehicleSpawned[i] = (-1);
}
MessageGiven[i] = false;
}
return 1;
}
public OnPlayerConnect(playerid)
{
if(VehicleSpawned[playerid] != -1){
DestroyVehicle(VehicleSpawned[playerid]);
VehicleSpawned[playerid] = (-1);
}
MessageGiven[playerid] = false;
SendClientMessage(playerid, COLOR_RED, "Admins use: /kvechelp");
return 1;
}
public OnPlayerDisconnect(playerid)
{
if(VehicleSpawned[playerid] != -1){
DestroyVehicle(VehicleSpawned[playerid]);
VehicleSpawned[playerid] = (-1);
}
MessageGiven[playerid] = false;
return 1;
}
public OnPlayerSpawn(playerid)
{
if(!MessageGiven[playerid]){
SendClientMessage(playerid, COLOR_RED, "Admins use: /kvechelp");
MessageGiven[playerid] = true;
}
return 1;
}
CMD:kvechelp(playerid, params[])
{
if(RconOnly && !IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "ERROR: This is for RCON admins only!");
SendClientMessage(playerid, COLOR_YELLOW, "|---------- Kwarde's Vehicle Spawn System ----------|");
SendClientMessage(playerid, COLOR_WHITE, "** /kvec [ID] -> Spawns a vehicle. [ID] is the vehicle model ID (eg. /kvec 411 for an infernus)");
SendClientMessage(playerid, COLOR_WHITE, "** /kcallvec -> Calls your spawned vehicle");
SendClientMessage(playerid, COLOR_WHITE, "** /kgotovec -> Teleports you into your spawned vehicle");
SendClientMessage(playerid, COLOR_WHITE, "** /kremovevec -> Removes your spawned vehicle");
SendClientMessage(playerid, COLOR_WHITE, "**!: /krcononly -> Toggle the commands above for RCON only on/off");
SendClientMessage(playerid, COLOR_WHITE, "**!: /krallvec -> Remove all spawned vehicles");
SendClientMessage(playerid, COLOR_YELLOW, "|---------- Kwarde's Vehicle Spawn System ----------|");
return 1;
}
CMD:kvec(playerid, params[])
{
if(RconOnly && !IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "ERROR: This is for RCON admins only!");
new Float:sPos[4];
if(!strlen(params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: {FFFF00}/kvec [ID]");
if(strval(params) < 400 || strval(params) > 611) return SendClientMessage(playerid, COLOR_RED, "ERROR: Invalid vehicle model ID");
if(IsPlayerInAnyVehicle(playerid)){
GetVehiclePos(GetPlayerVehicleID(playerid), sPos[0], sPos[1], sPos[2]);
GetVehicleZAngle(GetPlayerVehicleID(playerid), sPos[3]);
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
SetVehicleToRespawn(GetPlayerVehicleID(playerid));
else
RemovePlayerFromVehicle(playerid);
}
else{
GetPlayerPos(playerid, sPos[0], sPos[1], sPos[2]);
GetPlayerFacingAngle(playerid, sPos[3]);
}
if(VehicleSpawned[playerid] != -1)
DestroyVehicle(VehicleSpawned[playerid]);
VehicleSpawned[playerid] = CreateVehicle(strval(params[0]), sPos[0], sPos[1], sPos[2], sPos[3], -1, -1, -1);
SetVehicleVirtualWorld(VehicleSpawned[playerid], GetPlayerVirtualWorld(playerid));
LinkVehicleToInterior(VehicleSpawned[playerid], GetPlayerInterior(playerid));
PutPlayerInVehicle(playerid, VehicleSpawned[playerid], 0);
SendClientMessage(playerid, COLOR_GREEN, "* Your vehicle has been spawned.");
return 1;
}
CMD:kcallvec(playerid, params[])
{
if(RconOnly && !IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "ERROR: This is for RCON admins only!");
if(VehicleSpawned[playerid] == -1) return SendClientMessage(playerid, COLOR_RED, "ERROR: You didn't spawn a vehicle yet.");
new Float:sPos[4];
if(IsPlayerInAnyVehicle(playerid)){
GetVehiclePos(GetPlayerVehicleID(playerid), sPos[0], sPos[1], sPos[2]);
GetVehicleZAngle(GetPlayerVehicleID(playerid), sPos[3]);
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
SetVehicleToRespawn(GetPlayerVehicleID(playerid));
else
RemovePlayerFromVehicle(playerid);
}
else{
GetPlayerPos(playerid, sPos[0], sPos[1], sPos[2]);
GetPlayerFacingAngle(playerid, sPos[3]);
}
RemoveAllPlayersFromVehicle(VehicleSpawned[playerid]);
SetVehiclePos(VehicleSpawned[playerid], sPos[0], sPos[1], sPos[2]);
SetVehicleZAngle(VehicleSpawned[playerid], sPos[3]);
SetVehicleVirtualWorld(VehicleSpawned[playerid], GetPlayerVirtualWorld(playerid));
LinkVehicleToInterior(VehicleSpawned[playerid], GetPlayerInterior(playerid));
PutPlayerInVehicle(playerid, VehicleSpawned[playerid], 0);
SendClientMessage(playerid, COLOR_GREEN, "* Your vehicle has been called.");
return 1;
}
CMD:kgotovec(playerid, params[])
{
if(RconOnly && !IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "ERROR: This is for RCON admins only!");
if(VehicleSpawned[playerid] == -1) return SendClientMessage(playerid, COLOR_RED, "ERROR: You didn't spawn a vehicle yet.");
RemoveAllPlayersFromVehicle(VehicleSpawned[playerid]);
PutPlayerInVehicle(playerid, VehicleSpawned[playerid], 0);
SendClientMessage(playerid, COLOR_GREEN, "* You've been teleported to your vehicle");
return 1;
}
CMD:kremovevec(playerid, params[])
{
if(RconOnly && !IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "ERROR: This is for RCON admins only!");
if(VehicleSpawned[playerid] == -1) return SendClientMessage(playerid, COLOR_RED, "ERROR: You didn't spawn a vehicle yet.");
DestroyVehicle(VehicleSpawned[playerid]);
VehicleSpawned[playerid] = (-1);
SendClientMessage(playerid, COLOR_GREEN, "* Your vehicle has been removed.");
return 1;
}
CMD:krcononly(playerid, params[])
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "ERROR: This is for RCON admins only!");
if(RconOnly){
RconOnly = false;
SendClientMessageToAll(COLOR_GREEN, "Vehicle Spawner available for everyone. (/kvechelp)");
}
else{
RconOnly = true;
SendClientMessageToAll(COLOR_RED, "* Kwarde's Vehicle Spawn System is now only avaible for RCON admins!");
}
return 1;
}
CMD:krallvec(playerid, params[])
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "ERROR: This is for RCON admins only!");
for(new i = 0; i < MAX_SLOTS; i++){
if(VehicleSpawned[i] != -1){
DestroyVehicle(VehicleSpawned[i]);
VehicleSpawned[i] = (-1);
}
MessageGiven[i] = false;
}
SendClientMessageToAll(COLOR_RED, "All spawned vehicles have removed by an Admin");
return 1;
}
stock RemoveAllPlayersFromVehicle(vehicleid)
{
for(new i = 0; i < MAX_SLOTS; i++)
if(IsPlayerInVehicle(i, vehicleid))
RemovePlayerFromVehicle(i);
return 1;
}