/veh crashes the server.
#1

command(veh, playerid, params[])
{
new carid, string[128], Float: CarToX, Float: CarToY, Float: CarToZ, physical_car_id;
if(sscanf(params, "d", carid))
{
if(Player[playerid][AdminLevel] >= 3)
{
SendClientMessage(playerid, WHITE, "Server: /veh [vehicleid]");
}
}
else
{
if(Player[playerid][AdminLevel] >= 3)
{
if(CarCount < MAX_VEHICLES)
{
if(carid < 400 || carid > 611)
{
SendClientMessage(playerid, WHITE, "Valid car IDs start from 400, ending at 611.");
return 1;
}
GetPlayerPos(playerid, CarToX, CarToY, CarToZ);
physical_car_id = CreateVehicle(carid, CarToX, CarToY+4, CarToZ, 90, -1, -1, -1);
format(string, sizeof(string), "PF11 %i", carid);
SetVehicleNumberPlate(physical_car_id, string);
SetVehicleToRespawn(physical_car_id);
PutPlayerInVehicle(playerid, physical_car_id, 0);
new vehid = GetPlayerVehicleID(playerid);
format(string, sizeof(string), "[AdmCmd] %s has spawned a vehicle; Model ID: %d - Vehicle ID: %d", RemoveUnderScore(playerid), carid, vehid);
SendToAdmins(RED, string, 0);
fuel[physical_car_id] = 100;
Player[playerid][KeyShare] = physical_car_id;
LinkVehicleToInterior(physical_car_id, GetPlayerInterior(playerid));
Engine[physical_car_id] = 0;
Windows[physical_car_id] = 0;
Siren[physical_car_id] = 0;
SirenObject[physical_car_id] = 0;
Lights[physical_car_id] = 0;
AdminSpawned[physical_car_id] = 1;
}
}
else return SendClientMessage(playerid, GREY, "You must be on Admin Duty to perform this command.");
}
return 1;
}
What's wrong?
Reply
#2

Why do you use so much things on it Siren SirenObject Lights AdminSpawned ? why just not easy so it wont crash ?
Reply
#3

pawn Код:
command(veh, playerid, params[])
{
new carid, string[128], Float: CarToX, Float: CarToY, Float: CarToZ, physical_car_id;
if(sscanf(params, "d", carid))
{
if(Player[playerid][AdminLevel] >= 3)
{
SendClientMessage(playerid, WHITE, "Server: /veh [vehicleid]");
}
}
else
{
if(Player[playerid][AdminLevel] >= 3)
{
if(CarCount < MAX_VEHICLES)
{
if(carid < 400 || carid > 611)
{
SendClientMessage(playerid, WHITE, "Valid car IDs start from 400, ending at 611.");
return 1;
}
GetPlayerPos(playerid, CarToX, CarToY, CarToZ);
physical_car_id = CreateVehicle(carid, CarToX, CarToY+4, CarToZ, 90, -1, -1, -1);
format(string, sizeof(string), "PF11 %i", carid);
SetVehicleNumberPlate(physical_car_id, string);
SetVehicleToRespawn(physical_car_id);
PutPlayerInVehicle(playerid, physical_car_id, 0);
new vehid = GetPlayerVehicleID(playerid);
format(string, sizeof(string), "[AdmCmd] %s has spawned a vehicle; Model ID: %d - Vehicle ID: %d", RemoveUnderScore(playerid), carid, vehid);
SendToAdmins(RED, string, 0);
fuel[physical_car_id] = 100;
Player[playerid][KeyShare] = physical_car_id;
LinkVehicleToInterior(physical_car_id, GetPlayerInterior(playerid));
Engine[physical_car_id] = 0;
Windows[physical_car_id] = 0;
Siren[physical_car_id] = 0;
SirenObject[physical_car_id] = 0;
Lights[physical_car_id] = 0;
AdminSpawned[physical_car_id] = 1;
}
}
else return SendClientMessage(playerid, GREY, "You must be on Admin Duty to perform this command.");
}
return 1;
}

Try to not use as many things such as this?
pawn Код:
new vehid = GetPlayerVehicleID(playerid);
format(string, sizeof(string), "[AdmCmd] %s has spawned a vehicle; Model ID: %d - Vehicle ID: %d",
and other stuff, maybe you have made it too complex?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)