Код:
CMD:subwoofer(playerid, params[])
{
new i;
new Sub[MAX_VEHICLES][6];
new Subwooferincar[MAX_PLAYERS];
new vid = GetPlayerVehicleID(playerid);
i = GetBuyCarId(playerid);
if( !IsPlayerInAnyVehicle( playerid ) ) return SendClientMessage( playerid, COLOR_WHITE, "You are not a car" );
if(PlayerInfo[playerid][pSubwoofer] == 0) return SendClientMessage(playerid, COLOR_WHITE, "* You dont have subwoofer.");
if(PlayerInfo[playerid][pSQLID] != AutoInfo[i][cOwner]) return SendClientMessage(playerid, COLOR_GRAD1, "Its not your car.");
if(!Subwooferincar[playerid])
{
Subwooferincar[playerid] = 1;
Sub[vid][0] = CreateObject(2232,0,0,0,0,0,0);
AttachObjectToVehicle(Sub[vid][0], vid, 0.025002, -1.729998, -0.020000, -74.369995, 87.133476, -3.015000);
SendEmoteMessage(playerid, "put subwoofer in car.");
CarInfo[i][cSubwoofer]++;
PlayerInfo[playerid][pSubwoofer]--;
OnCarUpdate(i);
}
else
{
Subwooferincar[playerid] = 0;
DestroyObject(Sub[vid][0]);
SendEmoteMessage(playerid, "remove subwoofer.");
CarInfo[i][cSubwoofer]--;
PlayerInfo[playerid][pSubwoofer]++;
OnCarUpdate(i);
}
return 1;
}
pawn Код:
OnPlayerCommandPerformed(playerid, cmdtext[], success) // Use this native to return the commands, and return true on OnPlayerCommandText
Код:
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
if(!success) SendClientMessage(playerid,0xFFFFFF,"Unknown command!");
return 1;
}