Car Delete
#1

Hi, can somebody help me to make a /deletecar command (only for admin) to delete player's car if he is on the driver state and send a reason. If the player is passenger to send a error message to the admin
Код:
[Error:]This player is not in a vehicle or is not a driver!
and also a reason for deleting the vehicle of player. An example for the message for the player:
Код:
Your vehicle has been deleted by admin %s [Reason:%s]
Reply
#2

I didn't test it, should work:
pawn Код:
COMMAND:deletecar(playerid, params[])
{
    new p, r[128], s[128], name[MAX_PLAYER_NAME];
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,-1,"You're not allowed to use this command!");
    if(sscanf(params,"ds[128]",p,r)) return SendClientMessage(playerid,-1,"Usage: /deletecar [Player ID] [Reason]");
    if(!IsPlayerInAnyVehicle(p)) return SendClientMessage(playerid,-1,"That player isn't in any vehicle!");
    DestroyVehicle(GetPlayerVehicleID(p));
    GetPlayerName(playerid,name,MAX_PLAYER_NAME);
    format(s,128,"Your vehicle has been destroyed by admin %s. [Reason: %s]",name,r);
    SendClientMessage(p,-1,s);
    GetPlayerName(p,name,MAX_PLAYER_NAME);
    format(s,128,"You destroyed %s's vehicle. [Reason: %s]",name,r);
    SendClientMessage(p,-1,s);
    return 1;
}
Also I can make a strcmp/strtok version if you need them. :P
Reply
#3

Quote:

Also I can make a strcmp/strtok version if you need them. :P

Please make it and why it is not checking is the player driver or it's not possible?
Reply
#4

It's possible:
pawn Код:
COMMAND:deletecar(playerid, params[])
{
    new p, r[128], s[128], name[MAX_PLAYER_NAME];
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,-1,"You're not allowed to use this command!");
    if(sscanf(params,"ds[128]",p,r)) return SendClientMessage(playerid,-1,"Usage: /deletecar [Player ID] [Reason]");
    if(!IsPlayerInAnyVehicle(p)) return SendClientMessage(playerid,-1,"That player isn't in any vehicle!");
    if(GetPlayerState(p) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid,-1,"That player isn't the driver!");
    DestroyVehicle(GetPlayerVehicleID(p));
    GetPlayerName(playerid,name,MAX_PLAYER_NAME);
    format(s,128,"Your vehicle has been destroyed by admin %s. [Reason: %s]",name,r);
    SendClientMessage(p,-1,s);
    GetPlayerName(p,name,MAX_PLAYER_NAME);
    format(s,128,"You destroyed %s's vehicle. [Reason: %s]",name,r);
    SendClientMessage(p,-1,s);
    return 1;
}
Also, what do you use? strtok and strcmp?
Best regards!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)