/destroyveh admin
#1

I have a porblem even make a script command like /destroyveh. So I can remove cars I spawned. As when I spawn them and make them explode, they will just respawn.

So I want a command as /destroyveh

A command like this:
Код:
dcmd_carcolor(playerid,params[]) {
	if(IsPlayerCommandLevel(playerid,"carcolor")) {
	    new tmp[256],tmp2[256],Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index);
	    if(!strlen(tmp)||!(strval(tmp) >= 0 && strval(tmp) <= 126)||!IsNumeric(tmp)||!IsNumeric(tmp2)) return SendClientMessage(playerid,red,"Syntax Error: \"/CARCOLOR <COLOR 1> (<COLOR 2>)\".");
		if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,red,"ERROR: You must be in a vehicle.");
        SendCommandMessageToAdmins(playerid,"CARCOLOR");
		if(!strlen(tmp2)) tmp2 = tmp;
		new string[256],name[24]; GetPlayerName(playerid,name,24);
		format(string,256,"You have set your color data to: [Color 1: %d || Color 2: %d]",strval(tmp),strval(tmp2));
		return ChangeVehicleColor(GetPlayerVehicleID(playerid),strval(tmp),strval(tmp2));
	} else return SendLevelErrorMessage(playerid,"carcolor");
}
But with the /Destroyveh command.

Please help me out!
Reply
#2

I can't really understand your system, but I have this scripted.
Quote:

CMD:destroycar(playerid, params[])
{
if(!CheckAdmin(playerid, ADMIN_LEVEL_1)) return NotAuthMSG(playerid);
if(!PlayerInCar(playerid)) return NotInCarMSG(playerid);
format(msg, sizeof(msg), "You've destroyed vehicle ID: %d.", GetPlayerVehicleID(playerid));
SCM(playerid, COLOR_GRAD4, msg);
DestoryCar(GetPlayerVehicleID(playerid));
return 1;
}

Quote:

if(strcmp(cmd, "/destroycar", true)== 0)
{
if(PlayerInfo[playerid][pAdmin] >= 4)
{
if(!vehenabled)
return SendClientMessage(playerid, GREY, "/veh was disabled by executive staff.");
new currentVehicle = GetPlayerVehicleID(playerid);
if(currentVehicle == 0) return SendClientMessage(playerid,GREY, " You must be in a vehicle to destroy it.");
new check;
for(new i = 0; i < sizeof(CreatedCars); i++)
{
if(CreatedCars[i] == currentVehicle)
{
check = 1;
CreatedCars[i] = INVALID_VEHICLE_ID;
break;
}
}
if(!check) return SendClientMessage(playerid, GREY, " You may only destroy a vehicle that was created with /veh.");

gDestroyVehicle[currentVehicle] = 1;
RemoveSiren(currentVehicle);
SetVehicleToRespawn(currentVehicle);
return 1;
}
else
{
SendClientMessage(playerid, GREY, " You are not authorized to use that command.");
}
}

Quote:

CMD:destroycars(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] < 4) {
SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
return 1;
}
for(new i = 0; i < sizeof(CreatedCars); i++) {
if(CreatedCars[i] != INVALID_VEHICLE_ID) {
DestroyVehicle(CreatedCars[i]);
CreatedCars[i] = INVALID_VEHICLE_ID;
}
}
SendClientMessageEx(playerid, COLOR_GREY, " Created vehicles destroyed!");
return 1;
}

Reply
#3

That was complicated for my pawno.. Crash.
Where to put these exactly?
Reply
#4

something like this:

Код:
CMD:destroyveh(playerid, params[])
{
        new veh;
        veh = GetPlayerVehicleID(playerid);
        DestroyVehicle(veh);
	return 1;
}
Reply
#5

Do you want them to respawn or not?
Reply
#6

Just want them to be destroyed
Reply
#7

I hope this works:
pawn Код:
dcmd_cardestroy(playerid,params[]) {
    if(IsPlayerCommandLevel(playerid,"cardestroy")) { // I named it cardestroy...
        if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,red,"ERROR: You must be in a vehicle.");
        SendCommandMessageToAdmins(playerid,"CARDESTROY");
        new string[256],name[24]; GetPlayerName(playerid,name,24);
        format(string,256,"You have destroyed your vehicle");
        SendClientMessage(playerid, red, string);
        return DestroyVehicle(GetPlayerVehicleID(playerid));
    } else return SendLevelErrorMessage(playerid,"carcolor");
}
But I don't know how your system works...
Reply
#8

C:\Users\X\Desktop\Testing server\250package\filterscripts\XtremeAdmin2.pwn(4 01) : warning 203: symbol is never used: "params"

Line 401: dcmd_cardestroy(playerid,params[]) {
Reply
#9

Yeah, I never work with dcmd, maybe try adding this?
pawn Код:
dcmd_cardestroy(playerid,params[]) {
        #pragma unused params
    if(IsPlayerCommandLevel(playerid,"cardestroy")) { // I named it cardestroy...
        if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,red,"ERROR: You must be in a vehicle.");
        SendCommandMessageToAdmins(playerid,"CARDESTROY");
        new string[256],name[24]; GetPlayerName(playerid,name,24);
        format(string,256,"You have destroyed your vehicle");
        SendClientMessage(playerid, red, string);
        return DestroyVehicle(GetPlayerVehicleID(playerid));
    } else return SendLevelErrorMessage(playerid,"carcolor");
}
Reply
#10

No errors, but it doesnt work,

Header size: 2284 bytes
Code size: 79716 bytes
Data size: 170368 bytes
Stack/heap size: 16384 bytes; estimated max. usage=5316 cells (21264 bytes)
Total requirements: 268752 bytes

Seems to be something with this..?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)