15.09.2014, 01:42
Hmm true.
pawn Код:
CMD:givecar(playerid,params[])
{
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if(PlayerInfo[playerid][pAdmin] < 3) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
if(!aDuty[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You are not on admin duty.");
new playerb, carid;
if(sscanf(params, "ui", playerb, carid)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /givecar [playerid] [carid]");
if(!IsPlayerConnected(playerb) || playerb == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "ERROR: This Player is Not Connected.");
if(!(400 <= carid <= 611)) return SendClientMessage(playerid, COLOR_RED, "ERROR: Invalid Vehicle Model!");
new Float:X, Float:Y, Float:Z, Float:angle, name1[MAX_PLAYER_NAME], name2[MAX_PLAYER_NAME], string[110];
GetPlayerPos(playerb, X, Y, Z);
GetPlayerFacingAngle(playerb, angle);
PlayerInfo[playerb][pVeh] = CreateVehicle(carid, X, Y, Z, angle, 0, 1, 60);
SetVehicleParamsEx(PlayerInfo[playerb][pVeh], 0, 0, 0, 1, 0, 0, 0);
PlayerInfo[playerb][vLocked] = 1;
PlayerInfo[playerb][vModel] = carid;
GetVehiclePos(PlayerInfo[playerb][pVeh], PlayerInfo[playerb][vX], PlayerInfo[playerb][vY], PlayerInfo[playerb][vZ]);
GetVehicleZAngle(PlayerInfo[playerb][pVeh], PlayerInfo[playerb][vA]);
PlayerInfo[playerb][vC1] = 0;
PlayerInfo[playerb][vC2] = 0;
GetPlayerName(playerid, name1, sizeof(name1));
GetPlayerName(playerb, name2, sizeof(name2));
format(string, sizeof(string), "[INFO]: Administrator %s Has Spawned a Vehicle id %d To %s.", name1, carid, name2);
SendClientMessageToAll(COLOR_PURPLE, string);
PutPlayerInVehicle(playerb, PlayerInfo[playerb][pVeh], 0);
return 1;
}