Subwoofer -
TouhGear - 25.11.2011
Код:
if(!strcmp(cmd, "/subwoofer", true))
{
new vid = GetPlayerVehicleID(playerid);
if(PlayerInfo[playerid][pSubwoofer])
{
if(!IsPlayerInAnyVehicle(playerid))
{
SendClientMessage(playerid, COLOR_GREY, " You are not car!");
return 1;
}
if(!SubwooferCar[playerid])
{
SubwooferCar[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);
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s put subwoofer in car.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
else
{
SubwooferAutos[playerid] = 0;
DestroyObject(Sub[vid][0]);
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s destroy subwoofer.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "* You must buy subwoofer.");
}
return 1;
}
How can I do so that I could only order a mounted subwoofer if you want the second time I have to first remove the first
Sorry bad english.
Re: Subwoofer -
TouhGear - 25.11.2011
Please help me somebody, how i can put one subwoofer in only my owned car, not put all car. Its Roleplay GM.
Re: Subwoofer -
Rob_Maate - 25.11.2011
Wait - So that code puts a sub in EVERY car?
I don't see it
Re: Subwoofer -
TouhGear - 26.11.2011
no, but i put subwoofer any car, But I would like to be able to put only bought the car itself
Re: Subwoofer -
Rob_Maate - 26.11.2011
Ahh I see.
Do you have a car ownership system already?
And if so - Did you write it? Or did you use one of the ones around the forums.
If it was the latter, post a link to the one you used and I'll show you how you can add that check
Re: Subwoofer -
TouhGear - 26.11.2011
Yes i have car ownership system. I have larp gamemode.
Re: Subwoofer -
Rob_Maate - 26.11.2011
kk I just downloaded the LARP mode and had a look @ it's variables.
This should work e'z
pawn Код:
if(strcmp(cmd, "/subwoofer", true == 0)
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
new CurrentDriver[64];
new CurrentVehicle;
GetPlayerName(playerid, CurrentDriver, sizeof(CurrentDriver);
CurrentVehicle = GetPlayerVehicleID(playerid);
if(CarInfo[CurrentVehicle][cOwned] == 1)
{
if(strfind(CarInfo[CurrentVehicle][cOwner], CurrentDriver, true) != -1)
{
if(PlayerInfo[playerid][pSubwoofer])
{
if(!SubwooferCar[playerid])
{
SubwooferCar[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);
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s installs a subwoofer into the car", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
else
{
SubwooferAutos[playerid] = 0;
DestroyObject(Sub[vid][0]);
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s removes a subwoofer from the car", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "* You must buy subwoofer.");
}
return 1;
}
else
{
//This is where you place code affecting a player who doesnt own the car but tried to attatch a subwoofer
return 1;
}
}
else
{
//this is where you place code affecting a player trying to put a subwoofer in a non-owned car
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " You are not in the drivers seat of a car.");
}
}
Re: Subwoofer -
TouhGear - 26.11.2011
Код:
if(!strcmp(cmd, "/subwoofer", true))
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
new vid = GetPlayerVehicleID(playerid);
new CurrentVehicle;
new CurrentDriver[64];
new sendername[MAX_PLAYER_NAME];
GetPlayerName(playerid,sendername,sizeof(sendername));
CurrentVehicle = GetPlayerVehicleID(playerid);
if(CarInfo[CurrentVehicle][cOwned] == 1)
{
if(strfind(CarInfo[CurrentVehicle][cOwner], CurrentDriver, true) != -1)
{
if(PlayerInfo[playerid][pSubwoofer])
{
if(!SubwooferCar[playerid])
{
SubwooferCar[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);
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s installs a subwoofer into the car", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
else
{
SubwooferCar[playerid] = 0;
DestroyObject(Sub[vid][0]);
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s removes a subwoofer from the car", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "* You must buy subwoofer.");
}
return 1;
}
else
{
//This is where you place code affecting a player who doesnt own the car but tried to attatch a subwoofer
return 1;
}
}
else
{
//this is where you place code affecting a player trying to put a subwoofer in a non-owned car
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " You are not in the drivers seat of a car.");
return 1;
}
}
Its not working.
Re: Subwoofer -
Rob_Maate - 26.11.2011
Does it compile?
Re: Subwoofer -
TouhGear - 26.11.2011
It compile, but when i buy car and use /subwoofer noting happen.