18.02.2012, 00:17
You're using ZCMD oddly. You don't need if(isnull) sscanf already has a built in null checker.
================================================== ===================
Defines a variable that will hold the vehicleid.
Checks if the player is Admin. The ! is if IsPlayerAdmin returns false. So basically. If a player is not admin then send them the message.
Checks if they left the command empty.
Checks if the vehicleid they typed is not in the script.
If everything else passes, then DestroyVehicle(vehicle) will the destroy the vehicle with variable they typed inside.
Formats the string and Sends the client the string as a message.
Goodluck.
pawn Code:
CMD:deleteveh(playerid, params[])
{
new vehicle;
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, KLEUR_WIT, "You are not an Administrator.");
if(sscanf(params,"i",vehicle)) return SendClientMessage(playerid, KLEUR_WIT, "{B4B5B7}USAGE: /deleteveh [vehicleid]");
if(vehicle == INVALID_VEHICLE_ID) return SendClientMessage(playerid,KLEUR_WIT,"Vehicle not found.");
else
{
DestroyVehicle(vehicle);
new string[128];
format(string, sizeof(string), "You succesfully deleted vehicle ID: %i", vehicle);
SendClientMessage(playerid,KLEUR_WIT,string);
return 1;
}
return 1;
}
pawn Code:
new vehicle;
pawn Code:
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, KLEUR_WIT, "You are not an Administrator.");
pawn Code:
if(sscanf(params,"i",vehicle)) return SendClientMessage(playerid, KLEUR_WIT, "{B4B5B7}USAGE: /deleteveh [vehicleid]");
pawn Code:
if(vehicle == INVALID_VEHICLE_ID) return SendClientMessage(playerid,KLEUR_WIT,"Vehicle not found.");
pawn Code:
else
{
DestroyVehicle(vehicle);
}
return 1;
}
pawn Code:
new string[128];
format(string, sizeof(string), "You succesfully deleted vehicle ID: %i", vehicle);
SendClientMessage(playerid,KLEUR_WIT,string);
Goodluck.