23.07.2013, 21:09
Gm:Raven's Roleplay
There is a bug in ravens roleplay please help me to remove it.
The bug is when a player buys a car it spawn's in san fierro which completely normal but the car doesn't have any id and isn't owned buy anyone and doesn't even need to /engine to move and when you do /stats i says:
Please Help me and Thanks in advance i dont know how to rep but i will to the one who helps me.
I know i am asking for alot but please help me out if you can.
i guess this is all the car related script.
[CODE]if(strcmp(cmd, "/v", true) == 0 || strcmp(cmd, "/vehicle", true) == 0) // By LordMan
{
if(IsPlayerConnected(playerid))
{
if(gPlayerLogged[playerid] == 0)
{
SendClientMessage(playerid, COLOR_GREY, " You need to login first ! ");
return 1;
}
new x_nr[64];
x_nr = strtok(cmdtext, idx);
if(!strlen(x_nr))
{
SendClientMessage(playerid, COLOR_WHITE, "HINT: (/v)ehicle [name]");
SendClientMessage(playerid, COLOR_WHITE, "Available names: park, lock, sell, sellto, color,paintjob,setcode,Plate");
return 1;
}
if(strcmp(x_nr,"sell",true) == 0)
{
if(IsAtDealership(playerid))
{
if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey] || GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey2])
{
new ownvehkey;
if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey]) { ownvehkey = PlayerInfo[playerid][pPcarkey]; }
else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey2]) { ownvehkey = PlayerInfo[playerid][pPcarkey2]; }
else { return 1; }
if(strcmp(sendername, CarInfo[ownvehkey][cOwner], true) == 0)
{
new carsellprice = GetVehiclePrice(ownvehkey) / 4 * 3;
SafeGivePlayerMoney(playerid,carsellprice);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
format(string, sizeof(string), "~w~You have sold your car for: ~n~~g~$%d", carsellprice);
GameTextForPlayer(playerid, string, 10000, 3);
if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey])
PlayerInfo[playerid][pPcarkey] = 9999;
else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey2])
PlayerInfo[playerid][pPcarkey2] = 9999;
SafeRemovePlayerFromVehicle(playerid);
CarInfo[ownvehkey][cOwned] = 0;
DestroyVehicle(ownvehkey);
TogglePlayerControllable(playerid, 1);
format(string, sizeof(string),"LARP/Vehicles/%d.ini",ownvehkey);
fremove(string);
OnPlayerUpdateEx(playerid);
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " You have to sit at your own car to sell it! ");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "You are not at a dealership");
return 1;
}
}
else if(strcmp(x_nr,"sellto",true) == 0)
{
if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey] || GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey2])
{
new ownvehkey;
if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey]) { ownvehkey = PlayerInfo[playerid][pPcarkey]; }
else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey2]) { ownvehkey = PlayerInfo[playerid][pPcarkey2]; }
else { return 1; }
if(strcmp(sendername, CarInfo[ownvehkey][cOwner], true) == 0)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "HINT: /v sellto [playerid/PartOfName] [price]");
return 1;
}
giveplayerid = ReturnUser(tmp);
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
if(ProxDetectorS(8.0, playerid, giveplayerid))
{
if(PlayerInfo[giveplayerid][pPcarkey] == 9999)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "HINT: /v sellto [playerid/PartOfName] [price]");
return 1;
}
new price;
price = strval(tmp);
if(price < 1 || price > 1500000)
{
SendClientMessage(playerid, COLOR_GREY, " Price not lower then 1 and not higher then 1500000. ");
return 1;
}
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
format(string, sizeof(string), "* You offerd %s to buy your car for $%d .", giveplayer, price);
SendClientMessage(playerid, COLOR_WHITE, string);
format(string, sizeof(string), "* Car Owner %s offered you to buy his/her car for $%d (type /accept ownablecar) to buy.", playername, price);
SendClientMessage(giveplayerid, COLOR_WHITE, string);
OwnableCarOffer[giveplayerid] = playerid;
OwnableCarID[giveplayerid] = ownvehkey;
OwnableCarPrice[giveplayerid] = price;
return 1;
}
}
else if(PlayerInfo[giveplayerid][pPcarkey2] == 9999)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "HINT: /v sellto [playerid/PartOfName] [price]");
return 1;
}
new price;
price = strval(tmp);
if(price < 1 || price > 1500000)
{
SendClientMessage(playerid, COLOR_GREY, " Price not lower then 1 and not higher then 1500000. ");
return 1;
}
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
format(string, sizeof(string), "* You offerd %s to buy your car for $%d .", giveplayer, price);
SendClientMessage(playerid, COLOR_WHITE, string);
format(string, sizeof(string), "* Car Owner %s offered you to buy his/her car for $%d (type /accept ownablecar) to buy.", playername, price);
SendClientMessage(giveplayerid, COLOR_WHITE, string);
OwnableCarOffer[giveplayerid] = playerid;
OwnableCarID[giveplayerid] = ownvehkey;
OwnableCarPrice[giveplayerid] = price;
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY, " Player is not near you ! ");
return 1;
}
}
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " This is not your car");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " You have to sit at your own car to sell it");
return 1;
}
}
if(strcmp(x_nr,"plate",true) == 0)
{
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[128];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: (/v)ehicle plate [text]");
return 1;
}
if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey] || GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey2])
{
new ownvehkey;
new car = GetPlayerVehicleID(playerid);
if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey]) { ownvehkey = PlayerInfo[playerid][pPcarkey]; }
else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey2]) { ownvehkey = PlayerInfo[playerid][pPcarkey2]; }
else { return 1; }
if(strcmp(sendername, CarInfo[ownvehkey][cOwner], true) == 0)
{
if(GetPlayerMoney(playerid) < 5000)
{
SendClientMessage(playerid,COLOR_WHITE,"You need 5000$ for the Plate Change!");
return 1;
}
strmid(CarInfo[car][cPlate], result, 0, strlen(result), 999);
new vid = GetPlayerVehicleID(playerid);
GivePlayerMoney(playerid,-5000);
SetVehicleNumberPlate(vid, CarInfo[vid][cPlate]);
RemovePlayerFromVehicle(playerid);
PlayerInfo[playerid][pPChanges] -= 1;
SetVehicleToRespawn(GetPlayerVehicleID(playerid));
OnPropUpdate(4,car);
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " Please sit in your car before selling! ");
return 1;
}
}
else if(strcmp(x_nr,"park",true) == 0)
{
new Float,Float:y,Float:z;
new Float:a;
new carid;
new getcarid;
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid,pname,sizeof(pname));
getcarid = GetPlayerVehicleID(playerid);
carid = GetPlayerVehicleID(playerid);
GetPlayerName(playerid, playername, sizeof(playername));
GetVehiclePos(carid, x, y, z);
GetVehicleZAngle(carid, a);
if(!strcmp(CarInfo[getcarid][cOwner], pname, false) && IsPlayerInVehicle(playerid,carid) && CarInfo[carid][cOwned] == 1)
{
if(PlayerInfo[playerid][pPcarkey] == 9999 && PlayerInfo[playerid][pPcarkey2] == 9999)
{
SendClientMessage(playerid, COLOR_GREY, "You don't own a vehicle.");
return 1;
}
if(getcarid == carid)
{
CarInfo[carid][cLocationx] = x;
CarInfo[carid][cLocationy] = y;
CarInfo[carid][cLocationz] = z;
CarInfo[carid][cAngle] = a;
new area[35];
GetPlayer2DZone(playerid, area, sizeof(area));
format(string, sizeof(string), "~w~Parked ~n~~b~(%s).",area);
GameTextForPlayer(playerid, string, 10000, 3);
format(string, sizeof(string), "Vehicle Parked: %f.01, %f.01, %f.01 Location: %s",x,y,z,area);
SendClientMessage(playerid, COLOR_YELLOW2, string);
OnPropUpdate(1,carid);
OnPlayerUpdateEx(playerid);
DestroyVehicle(carid);
ownedcar[carid] = CreateVehicle(CarInfo[carid][cModel],CarInfo[carid][cLocationx],CarInfo[carid][cLocationy],CarInfo[carid][cLocationz]+1.0,CarInfo[carid][cAngle],CarInfo[carid][cColorOne],CarInfo[carid][cColorTwo],60000);
if(CarInfo[carid][cPaintjob] != 999)
{
ChangeVehiclePaintjob(carid, CarInfo[carid][cPaintjob]);
}
SetVehicleVirtualWorld(carid, CarInfo[carid][cVirWorld]);
SetVehicleModifications(carid);
TogglePlayerControllable(playerid, 1);
PutPlayerInVehicle(playerid, carid, 0);
return 1;
}
}
}
else if(strcmp(x_nr,"setcode",true) == 0)
{
new carid;
if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey]) { carid = PlayerInfo[playerid][pPcarkey]; }
else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey2]) { carid = PlayerInfo[playerid][pPcarkey2]; }
else { return 1; }
if(IsPlayerInVehicle(playerid,carid) && CarInfo[carid][cOwned] == 1)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "HINT: /v setcode
There is a bug in ravens roleplay please help me to remove it.
The bug is when a player buys a car it spawn's in san fierro which completely normal but the car doesn't have any id and isn't owned buy anyone and doesn't even need to /engine to move and when you do /stats i says:
Please Help me and Thanks in advance i dont know how to rep but i will to the one who helps me.
I know i am asking for alot but please help me out if you can.
i guess this is all the car related script.
[CODE]if(strcmp(cmd, "/v", true) == 0 || strcmp(cmd, "/vehicle", true) == 0) // By LordMan
{
if(IsPlayerConnected(playerid))
{
if(gPlayerLogged[playerid] == 0)
{
SendClientMessage(playerid, COLOR_GREY, " You need to login first ! ");
return 1;
}
new x_nr[64];
x_nr = strtok(cmdtext, idx);
if(!strlen(x_nr))
{
SendClientMessage(playerid, COLOR_WHITE, "HINT: (/v)ehicle [name]");
SendClientMessage(playerid, COLOR_WHITE, "Available names: park, lock, sell, sellto, color,paintjob,setcode,Plate");
return 1;
}
if(strcmp(x_nr,"sell",true) == 0)
{
if(IsAtDealership(playerid))
{
if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey] || GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey2])
{
new ownvehkey;
if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey]) { ownvehkey = PlayerInfo[playerid][pPcarkey]; }
else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey2]) { ownvehkey = PlayerInfo[playerid][pPcarkey2]; }
else { return 1; }
if(strcmp(sendername, CarInfo[ownvehkey][cOwner], true) == 0)
{
new carsellprice = GetVehiclePrice(ownvehkey) / 4 * 3;
SafeGivePlayerMoney(playerid,carsellprice);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
format(string, sizeof(string), "~w~You have sold your car for: ~n~~g~$%d", carsellprice);
GameTextForPlayer(playerid, string, 10000, 3);
if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey])
PlayerInfo[playerid][pPcarkey] = 9999;
else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey2])
PlayerInfo[playerid][pPcarkey2] = 9999;
SafeRemovePlayerFromVehicle(playerid);
CarInfo[ownvehkey][cOwned] = 0;
DestroyVehicle(ownvehkey);
TogglePlayerControllable(playerid, 1);
format(string, sizeof(string),"LARP/Vehicles/%d.ini",ownvehkey);
fremove(string);
OnPlayerUpdateEx(playerid);
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " You have to sit at your own car to sell it! ");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "You are not at a dealership");
return 1;
}
}
else if(strcmp(x_nr,"sellto",true) == 0)
{
if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey] || GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey2])
{
new ownvehkey;
if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey]) { ownvehkey = PlayerInfo[playerid][pPcarkey]; }
else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey2]) { ownvehkey = PlayerInfo[playerid][pPcarkey2]; }
else { return 1; }
if(strcmp(sendername, CarInfo[ownvehkey][cOwner], true) == 0)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "HINT: /v sellto [playerid/PartOfName] [price]");
return 1;
}
giveplayerid = ReturnUser(tmp);
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
if(ProxDetectorS(8.0, playerid, giveplayerid))
{
if(PlayerInfo[giveplayerid][pPcarkey] == 9999)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "HINT: /v sellto [playerid/PartOfName] [price]");
return 1;
}
new price;
price = strval(tmp);
if(price < 1 || price > 1500000)
{
SendClientMessage(playerid, COLOR_GREY, " Price not lower then 1 and not higher then 1500000. ");
return 1;
}
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
format(string, sizeof(string), "* You offerd %s to buy your car for $%d .", giveplayer, price);
SendClientMessage(playerid, COLOR_WHITE, string);
format(string, sizeof(string), "* Car Owner %s offered you to buy his/her car for $%d (type /accept ownablecar) to buy.", playername, price);
SendClientMessage(giveplayerid, COLOR_WHITE, string);
OwnableCarOffer[giveplayerid] = playerid;
OwnableCarID[giveplayerid] = ownvehkey;
OwnableCarPrice[giveplayerid] = price;
return 1;
}
}
else if(PlayerInfo[giveplayerid][pPcarkey2] == 9999)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "HINT: /v sellto [playerid/PartOfName] [price]");
return 1;
}
new price;
price = strval(tmp);
if(price < 1 || price > 1500000)
{
SendClientMessage(playerid, COLOR_GREY, " Price not lower then 1 and not higher then 1500000. ");
return 1;
}
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
format(string, sizeof(string), "* You offerd %s to buy your car for $%d .", giveplayer, price);
SendClientMessage(playerid, COLOR_WHITE, string);
format(string, sizeof(string), "* Car Owner %s offered you to buy his/her car for $%d (type /accept ownablecar) to buy.", playername, price);
SendClientMessage(giveplayerid, COLOR_WHITE, string);
OwnableCarOffer[giveplayerid] = playerid;
OwnableCarID[giveplayerid] = ownvehkey;
OwnableCarPrice[giveplayerid] = price;
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY, " Player is not near you ! ");
return 1;
}
}
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " This is not your car");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " You have to sit at your own car to sell it");
return 1;
}
}
if(strcmp(x_nr,"plate",true) == 0)
{
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[128];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: (/v)ehicle plate [text]");
return 1;
}
if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey] || GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey2])
{
new ownvehkey;
new car = GetPlayerVehicleID(playerid);
if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey]) { ownvehkey = PlayerInfo[playerid][pPcarkey]; }
else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey2]) { ownvehkey = PlayerInfo[playerid][pPcarkey2]; }
else { return 1; }
if(strcmp(sendername, CarInfo[ownvehkey][cOwner], true) == 0)
{
if(GetPlayerMoney(playerid) < 5000)
{
SendClientMessage(playerid,COLOR_WHITE,"You need 5000$ for the Plate Change!");
return 1;
}
strmid(CarInfo[car][cPlate], result, 0, strlen(result), 999);
new vid = GetPlayerVehicleID(playerid);
GivePlayerMoney(playerid,-5000);
SetVehicleNumberPlate(vid, CarInfo[vid][cPlate]);
RemovePlayerFromVehicle(playerid);
PlayerInfo[playerid][pPChanges] -= 1;
SetVehicleToRespawn(GetPlayerVehicleID(playerid));
OnPropUpdate(4,car);
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " Please sit in your car before selling! ");
return 1;
}
}
else if(strcmp(x_nr,"park",true) == 0)
{
new Float,Float:y,Float:z;
new Float:a;
new carid;
new getcarid;
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid,pname,sizeof(pname));
getcarid = GetPlayerVehicleID(playerid);
carid = GetPlayerVehicleID(playerid);
GetPlayerName(playerid, playername, sizeof(playername));
GetVehiclePos(carid, x, y, z);
GetVehicleZAngle(carid, a);
if(!strcmp(CarInfo[getcarid][cOwner], pname, false) && IsPlayerInVehicle(playerid,carid) && CarInfo[carid][cOwned] == 1)
{
if(PlayerInfo[playerid][pPcarkey] == 9999 && PlayerInfo[playerid][pPcarkey2] == 9999)
{
SendClientMessage(playerid, COLOR_GREY, "You don't own a vehicle.");
return 1;
}
if(getcarid == carid)
{
CarInfo[carid][cLocationx] = x;
CarInfo[carid][cLocationy] = y;
CarInfo[carid][cLocationz] = z;
CarInfo[carid][cAngle] = a;
new area[35];
GetPlayer2DZone(playerid, area, sizeof(area));
format(string, sizeof(string), "~w~Parked ~n~~b~(%s).",area);
GameTextForPlayer(playerid, string, 10000, 3);
format(string, sizeof(string), "Vehicle Parked: %f.01, %f.01, %f.01 Location: %s",x,y,z,area);
SendClientMessage(playerid, COLOR_YELLOW2, string);
OnPropUpdate(1,carid);
OnPlayerUpdateEx(playerid);
DestroyVehicle(carid);
ownedcar[carid] = CreateVehicle(CarInfo[carid][cModel],CarInfo[carid][cLocationx],CarInfo[carid][cLocationy],CarInfo[carid][cLocationz]+1.0,CarInfo[carid][cAngle],CarInfo[carid][cColorOne],CarInfo[carid][cColorTwo],60000);
if(CarInfo[carid][cPaintjob] != 999)
{
ChangeVehiclePaintjob(carid, CarInfo[carid][cPaintjob]);
}
SetVehicleVirtualWorld(carid, CarInfo[carid][cVirWorld]);
SetVehicleModifications(carid);
TogglePlayerControllable(playerid, 1);
PutPlayerInVehicle(playerid, carid, 0);
return 1;
}
}
}
else if(strcmp(x_nr,"setcode",true) == 0)
{
new carid;
if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey]) { carid = PlayerInfo[playerid][pPcarkey]; }
else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey2]) { carid = PlayerInfo[playerid][pPcarkey2]; }
else { return 1; }
if(IsPlayerInVehicle(playerid,carid) && CarInfo[carid][cOwned] == 1)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "HINT: /v setcode
Код:
"); SendClientMessage(playerid, COLOR_WHITE, "Between one and Two digits, Every Digit will cost you 3000"); SendClientMessage(playerid, COLOR_WHITE, "Between three and four digits, Every Digit will cost you 6000"); SendClientMessage(playerid, COLOR_WHITE, "Between five and seven digits, Every Digit will cost you 8000"); SendClientMessage(playerid, COLOR_WHITE, "Between four and seven digits, Every Digit will cost you 6000"); SendClientMessage(playerid, COLOR_WHITE, "And a code with 8 characters will cost you 80000$"); return 1; } new price; price = strval(tmp); Digits = GetDigits(strval(tmp)); if(Digits <= 0 && Digits >= 11) return SendClientMessage(playerid,COLOR_GREY,"* Security code must contain between 1 and 12 characters"); new FinalPrice; if(Digits >= 1 && Digits <= 2) { FinalPrice = 3000*Digits; } else if(Digits >= 3 && Digits <= 4) { FinalPrice = 6000*Digits; } else if(Digits >= 5 && Digits <= 7) { FinalPrice = 8000*Digits; } else if(Digits == 8) { FinalPrice = 10000*Digits; } if(GetPlayerMoney(playerid) < FinalPrice) { format(string, sizeof(string),"You cannot afford that much ($%d)!",FinalPrice); SendClientMessage(playerid, COLOR_GREY,string); return 1; } SafeGivePlayerMoney(playerid, -FinalPrice); CarInfo[carid][cCode] = price; OnPropUpdate(4,carid); format(string, sizeof(string),"* New car security code is %d, and it costed you $%d!!", price, FinalPrice); SendClientMessage(playerid, COLOR_GREY, string); } } else if(strcmp(x_nr,"lock",true) == 0) { new keycar = PlayerInfo[playerid][pPcarkey]; if(keycar != 9999) { new Float:X,Float:Y,Float:Z; GetVehiclePos(keycar,X,Y,Z); if(IsPlayerInRangeOfPoint(playerid, 25,X,Y,Z)) { new locked[128]; locked = strtok(cmdtext, idx); if(CarInfo[keycar][cLock] == 1) { format(string, sizeof(string), "~w~Vehicle~n~~g~Unlocked"); GameTextForPlayer(playerid, string, 4000, 3); CarInfo[keycar][cLock] = 0; OnPropUpdate(4,keycar); return 1; } else if(CarInfo[keycar][cLock] == 0) { format(string, sizeof(string), "~w~Vehicle~n~~r~Locked"); GameTextForPlayer(playerid, string, 4000, 3); CarInfo[keycar][cLock] = 1; OnPropUpdate(4,keycar); return 1; } } else { SendClientMessage(playerid, COLOR_GREY,"* You must be Near or in Your car to lock it!"); return 1; } } else { SendClientMessage(playerid, COLOR_GREY, "* You don't have a vehicle at slot 1"); return 1; } } else if(strcmp(x_nr,"lock2",true) == 0) { new keycar = PlayerInfo[playerid][pPcarkey2]; if(keycar != 9999) { new Float:X,Float:Y,Float:Z; GetVehiclePos(keycar,X,Y,Z); if(IsPlayerInRangeOfPoint(playerid, 25,X,Y,Z)) { new locked[128]; locked = strtok(cmdtext, idx); if(CarInfo[keycar][cLock] == 1) { format(string, sizeof(string), "~w~Vehicle~n~~g~Unlocked"); GameTextForPlayer(playerid, string, 4000, 3); CarInfo[keycar][cLock] = 0; OnPropUpdate(4,keycar); return 1; } else if(CarInfo[keycar][cLock] == 0) { format(string, sizeof(string), "~w~Vehicle~n~~r~Locked"); GameTextForPlayer(playerid, string, 4000, 3); CarInfo[keycar][cLock] = 1; OnPropUpdate(4,keycar); return 1; } } else { SendClientMessage(playerid, COLOR_GREY,"* You must be Near or in Your car to lock it!"); return 1; } } else { SendClientMessage(playerid, COLOR_GREY, " You don't have a vehicle at slot 2"); return 1; } } else if(strcmp(x_nr,"color",true) == 0) { if(PlayerInfo[playerid][pPcarkey] == 9999 && PlayerInfo[playerid][pPcarkey2] == 9999) { SendClientMessage(playerid, COLOR_GREY,"* You don't have a vehicle to respray."); return 1; } if(!IsAtDealership(playerid) && !IsAtPaySpray(playerid)) { SendClientMessage(playerid, COLOR_GREY,"* You must be at a Dealership or a Pay'n'Spray to do this!"); return 1; } if(GetPlayerMoney(playerid) < 1000) { SendClientMessage(playerid, COLOR_GREY,"* You don't have enough money for vehicle respray."); return 1; } tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_WHITE, "USAGE: /v color [ColorOneID] [ColorTwoID]"); return 1; } new color1; color1 = strval(tmp); if(color1 < 0 && color1 > 126) { SendClientMessage(playerid, COLOR_GREY, " Wrong color id!"); return 1; } tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_WHITE, "USAGE: /v color [ColorOneID] [ColorTwoID]"); return 1; } new color2; color2 = strval(tmp); if(color2 < 0 && color2 > 126) { SendClientMessage(playerid, COLOR_GREY, " Wrong color id!"); return 1; } new vehid; if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey]) { vehid = PlayerInfo[playerid][pPcarkey]; } else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey2]) { vehid = PlayerInfo[playerid][pPcarkey2]; } else { return 1; } if(IsPlayerInVehicle(playerid, vehid)) { CarInfo[vehid][cColorOne] = color1; CarInfo[vehid][cColorTwo] = color2; new Float:x,Float:y,Float:z; GetPlayerPos(playerid, x,y,z); ChangeVehicleColor(vehid, color1, color2); SafeGivePlayerMoney(playerid, -1000); GameTextForPlayer(playerid, "~w~Bill for a Paint Respray~n~~r~-$1000", 5000, 1); ChangeVehicleColor(vehid, color1, color2); OnPropUpdate(4,vehid); OnPlayerUpdateEx(playerid); return 1; } else { SendClientMessage(playerid, COLOR_GREY," You are not in your vehicle."); return 1; } } else if(strcmp(x_nr,"buy",true) == 0) { new car = 1; new model = GetVehicleModel(idcar); if(IsASalesVehicle(idcar)) { if(PlayerInfo[playerid][pLevel] < 2) { SendClientMessage(playerid, COLOR_GREY, "You need to be level 2 to buy a vehicle!"); return 1; } if(PlayerInfo[playerid][pPcarkey] == 9999 || PlayerInfo[playerid][pPcarkey2] == 9999) { } else return SendClientMessage(playerid, COLOR_GREY,"* You already own Two cars!"); if(GetPlayerMoney(playerid) >= GetVehiclePrice(idcar)) { if(PlayerInfo[playerid][pCarLic] == 1) { for(new h = 1; h < sizeof(CarInfo); h++) { if(CarInfo[h][cOwned] == 0) { car = h; h = 9999; } } format(string, sizeof(string),"LARP/Vehicles/%d.ini",car) dini_Create(string); if(PlayerInfo[playerid][pPcarkey] != 9999) { PlayerInfo[playerid][pPcarkey2] = car; } else { PlayerInfo[playerid][pPcarkey] = car; } CarInfo[car][cOwned] = 1; strmid(CarInfo[car][cOwner], sendername, 0, strlen(sendername), 999); SafeGivePlayerMoney(playerid,-GetVehiclePrice(idcar)); if(IsModelAPlane(idcar) || IsModelAHeli(idcar)) { CarInfo[car][cLocationx] = 1432.6451; CarInfo[car][cLocationy] = 1378.7216; CarInfo[car][cLocationz] = 11.5507; CarInfo[car][cAngle] = 359.2072; SendClientMessage(playerid, COLOR_YELLOW2, "Your Aircraft has been deliveried to Las Venturas Airport, you can get it there!"); SendClientMessage(playerid, COLOR_YELLOW2, "Your vehicle is unlocked so you can pay someone to deliver it to your new spawn point!"); SendClientMessage(playerid, COLOR_NICERED, "REMEMBER: Leaving your car in the deliver point can get your car SOLD by an administration without refund!"); GameTextForPlayer(playerid, "~p~Congratulations~n~~w~Don't forget to pickup your car at the ~b~Las Venturas Airport!", 5000, 3); } else if(IsModelABoat(idcar)) { CarInfo[car][cLocationx] = -1568.9614; CarInfo[car][cLocationy] = 169.0118; CarInfo[car][cLocationz] = -0.6016; CarInfo[car][cAngle] = 208.7506; SendClientMessage(playerid, COLOR_YELLOW2, "Your Boat has been deliveried to San Fierro Docks, you can get it there!"); SendClientMessage(playerid, COLOR_YELLOW2, "Your vehicle is unlocked so you can pay someone to deliver it to your new spawn point!"); SendClientMessage(playerid, COLOR_NICERED, "REMEMBER: Leaving your car in the deliver point can get your car SOLD by an administration without refund!"); GameTextForPlayer(playerid, "~p~Congratulations~n~~w~Don't forget to pickup your car at the ~b~San Fierro Docks!", 5000, 3); } else { CarInfo[car][cLocationx] = -1589.2644; CarInfo[car][cLocationy] = 106.9119; CarInfo[car][cLocationz] = 3.5495; CarInfo[car][cAngle] = 317.1649; SendClientMessage(playerid, COLOR_YELLOW2, "Your vehicle has been deliveried to San Fierro Docks, you can get it there!"); SendClientMessage(playerid, COLOR_YELLOW2, "Your vehicle is unlocked so you can pay someone to deliver it to your new spawn point!"); SendClientMessage(playerid, COLOR_NICERED, "REMEMBER: Leaving your car in the deliver point can get your car SOLD by an administration without refund!"); GameTextForPlayer(playerid, "~p~Congratulations~n~~w~Don't forget to pickup your car at the ~b~San Fierro Docks!", 5000, 3); } CarInfo[car][cModel] = model; CarInfo[car][cVirWorld] = 0; CarInfo[car][cPaintjob] = 999; CarInfo[car][cColorOne] = 1; CarInfo[car][cColorTwo] = 1; CarInfo[car][cComponent0] = 0; CarInfo[car][cComponent1] = 0; CarInfo[car][cComponent2] = 0; CarInfo[car][cComponent3] = 0; CarInfo[car][cComponent4] = 0; CarInfo[car][cComponent5] = 0; CarInfo[car][cComponent6] = 0; CarInfo[car][cComponent7] = 0; CarInfo[car][cComponent8] = 0; CarInfo[car][cComponent9] = 0; CarInfo[car][cComponent10] = 0; CarInfo[car][cComponent11] = 0; CarInfo[car][cComponent12] = 0; CarInfo[car][cComponent13] = 0; //DestroyVehicle(car); ownedcar[car] = CreateVehicle(CarInfo[car][cModel],CarInfo[car][cLocationx],CarInfo[car][cLocationy],CarInfo[car][cLocationz],90.0,1,1,30000); PlayerPlayMusic(playerid); SendClientMessage(playerid, COLOR_GRAD2, "Congratulations on your new purchase!"); SendClientMessage(playerid, COLOR_GRAD2, "Type /vehiclehelp to view the vehicle manual!"); gEngine[playerid] = 0; engineOn[GetPlayerVehicleID(playerid)] = false; SendClientMessage(playerid, COLOR_GREY, "Remember to set the new Security Code of the Car (/v setcode)!"); new pass[24]; format(pass, sizeof(pass),"%d%d%d",random(9),random(9),random(9)); CarInfo[car][cCode] = strval(pass); OnPropUpdate(4,car); OnPlayerUpdateEx(playerid); } else { SendClientMessage(playerid, COLOR_WHITE, "* For security reasons, a Driving License is needed to buy a car!"); return 1; } } else { SendClientMessage(playerid, COLOR_GREY, " You don't have enough cash with you ! "); return 1; } } } else if(strcmp(x_nr,"paintjob",true) == 0) { if(PlayerInfo[playerid][pPcarkey] == 9999 || PlayerInfo[playerid][pPcarkey2] == 9999) { SendClientMessage(playerid, COLOR_GREY," You don't have a vehicle to respray."); return 1; } if(!IsAtDealership(playerid) && !IsAtPaySpray(playerid)) { SendClientMessage(playerid, COLOR_GREY,"* You must be at a Dealership or a Pay'n'Spray to do this!"); return 1; } if(GetPlayerMoney(playerid) < 5000) { SendClientMessage(playerid, COLOR_GREY," You don't have enough money for vehicle respray."); return 1; } tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_WHITE, "USAGE: /v paintjob [paintjob(0-3)]"); return 1; } new color1; color1 = strval(tmp); if(color1 < 0 && color1 > 3) { SendClientMessage(playerid, COLOR_GREY, " Wrong color id!"); return 1; } new vehid; if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey]) { vehid = PlayerInfo[playerid][pPcarkey]; } else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey2]) { vehid = PlayerInfo[playerid][pPcarkey2]; } else { return 1; } if(IsPlayerInVehicle(playerid, vehid)) { CarInfo[vehid][cPaintjob] = color1; SafeGivePlayerMoney(playerid, -5000); GameTextForPlayer(playerid, "~w~Bill for a Paint Respray~n~~r~-$5000", 5000, 1); ChangeVehiclePaintjob(vehid, color1); OnPropUpdate(4,vehid); OnPlayerUpdateEx(playerid); return 1; } else { SendClientMessage(playerid, COLOR_GREY," You are not in your vehicle."); return 1; } } else { SendClientMessage(playerid, COLOR_WHITE, "HINT: (/v)ehicle [name]"); SendClientMessage(playerid, COLOR_WHITE, "Available names: park, lock(1-2), sell, sellto, color, paintjob"); return 1; } } return 1; } if(strcmp(cmd, "/trunk", true) == 0) // By LordMan { if(IsPlayerConnected(playerid)) { new x_nr[24]; x_nr = strtok(cmdtext, idx); if(!strlen(x_nr)) { SendClientMessage(playerid, COLOR_WHITE, "HINT: /trunk [name]"); SendClientMessage(playerid, COLOR_WHITE, "Available names: info, putgun, takegun, putarmour, takearmour"); if(PlayerInfo[playerid][pLeader] == 1 || PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 2 || PlayerInfo[playerid][pMember] == 2) { SendClientMessage(playerid, COLOR_WHITE, "You can /trunk frisk as a cop"); } return 1; } if(strcmp(x_nr,"info",true) == 0) { new counter = 0; new result; new plyName[MAX_PLAYER_NAME]; GetPlayerName(playerid, plyName, MAX_PLAYER_NAME); for(new i; i != MAX_VEHICLES; i++) { new dist = CheckPlayerDistanceToVehicle(3.5, playerid, i); if(dist) { result = i; counter++; } } switch(counter) { case 0: { SendClientMessage(playerid, COLOR_GREY, " No cars with trunk near you"); } case 1: { if(IsAnOwnableCar(result)) { if(PlayerInfo[playerid][pPcarkey] == result) { } else if(PlayerInfo[playerid][pPcarkey2] == result) { } else { SendClientMessage(playerid, COLOR_GREY, " Trunk is locked !"); return 1; } } if(IsPlayerInAnyVehicle(playerid)) { SendClientMessage(playerid, COLOR_GREY, " You can't open the trunk while you're in the car"); return 1; } if(IsAPlane(result) || IsABike(result) || IsAOBike(result) || IsABoat(result) || IsAPizzabike(result) || IsABus(result) || IsATowcar(result) || IsAHarvest(result) || IsADrugHarvest(result) || IsASweeper(result) || result >=78 && result <= 83 || GetVehicleModel(GetPlayerVehicleID(result)) == 523) { SendClientMessage(playerid, COLOR_GREY, " This vehicle doesn't have the trunk !"); return 1; } SendClientMessage(playerid, COLOR_LIGHT_BLUE, "|_______ Vehicle Trunk _______|"); for(new slot = 1; slot != MAX_TRUNK_SLOTS; slot++) { new gunname[24]; if(vehTrunk[result][slot] != 0) { GetWeaponName(vehTrunk[result][slot], gunname, sizeof(gunname)); format(string, sizeof(string), "| Slot %i: %s (Ammo: %i)", slot, gunname, vehTrunkAmmo[result][slot]); SendClientMessage(playerid, COLOR_WHITE, string); } else { format(string, sizeof(string), "| Slot %i: Empty (Ammo: N/A)", slot); SendClientMessage(playerid, COLOR_WHITE, string); } } format(string, sizeof(string), "| Body armour: %f%", vehTrunkArmour[result]); SendClientMessage(playerid, COLOR_WHITE, string); format(string, sizeof(string), "* %s opens the trunk and checks what is inside.", sendername); ProxDetector(30.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5); return 1; } default: { SendClientMessage(playerid, COLOR_GREY, " Found more then one car in range"); return 1; } } return 1; } else if(strcmp(x_nr,"putgun",true) == 0) { new counter = 0; new result; new plyName[MAX_PLAYER_NAME]; GetPlayerName(playerid, plyName, MAX_PLAYER_NAME); for(new i; i != MAX_VEHICLES; i++) { new dist = CheckPlayerDistanceToVehicle(3.5, playerid, i); if(dist) { result = i; counter++; } } switch(counter) { case 0: { SendClientMessage(playerid, COLOR_GREY, " No cars with trunk near you"); } case 1: { if(vehTrunkCounter[result] != (MAX_TRUNK_SLOTS-1)) { if(IsAnOwnableCar(result)) { if(PlayerInfo[playerid][pPcarkey] == result) { } else if(PlayerInfo[playerid][pPcarkey2] == result) { } else { SendClientMessage(playerid, COLOR_GREY, " Trunk is locked !"); return 1; } } if(ReduceTime[playerid] == 1) { SendClientMessage(playerid, COLOR_GREY, " You need to wait 3 seconds before using this command !"); return 1; } if(IsPlayerInAnyVehicle(playerid)) { SendClientMessage(playerid, COLOR_GREY, " You can't open the trunk while you're in the car"); return 1; } if(IsAPlane(result) || IsABike(result) || IsAOBike(result) || IsABoat(result) || IsAPizzabike(result) || IsABus(result) || IsATowcar(result) || IsAHarvest(result) || IsADrugHarvest(result) || IsASweeper(result) || result >=78 && result <= 83|| GetVehicleModel(GetPlayerVehicleID(result)) == 523) { SendClientMessage(playerid, COLOR_GREY, " This vehicle doesn't have the trunk !"); return 1; } new buffer[128]; new gunname[24]; new gunID = GetPlayerWeapon(playerid); new gunAmmo = GetPlayerAmmo(playerid); if(gunID != 0 && gunAmmo != 0) { ReduceTime[playerid] = 1; SetTimerEx("ReduceTimer", 3000, false, "i", playerid); GetWeaponName(gunID, gunname, sizeof(gunname)); vehTrunkCounter[result]++; vehTrunk[result][vehTrunkCounter[result]] = gunID; vehTrunkAmmo[result][vehTrunkCounter[result]] = gunAmmo; format(buffer, sizeof(buffer), "You have put your %s (Ammo: %i) in the car's trunk.", gunname, gunAmmo); SendClientMessage(playerid, COLOR_WHITE, buffer); RemovePlayerWeapon(playerid, gunID); format(string, sizeof(string), "* %s opens car's trunk and puts a weapon there.", sendername); ProxDetector(30.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5); SaveTrunk(); return 1; } } else { SendClientMessage(playerid, COLOR_GREY, " Car's trunk is full"); return 1; } } default: { SendClientMessage(playerid, COLOR_GREY, " Found more then one car in range"); return 1; } } return 1; } else if(strcmp(x_nr,"takegun",true) == 0) { new counter = 0; new result; new plyName[MAX_PLAYER_NAME]; GetPlayerName(playerid, plyName, MAX_PLAYER_NAME); for(new i; i != MAX_VEHICLES; i++) { new dist = CheckPlayerDistanceToVehicle(3.5, playerid, i); if(dist) { result = i; counter++; } } switch(counter) { case 0: { SendClientMessage(playerid, COLOR_GREY, " No cars with trunk near you"); return 1; } case 1: { if(IsPlayerInAnyVehicle(playerid)) { SendClientMessage(playerid, COLOR_GREY, " You can't open the trunk while you're in the car"); return 1; } if(ReduceTime[playerid] == 1) { SendClientMessage(playerid, COLOR_GREY, " You need to wait 3 seconds before using this command !"); return 1; } if(IsAnOwnableCar(result)) { if(PlayerInfo[playerid][pPcarkey] == result) { } else if(PlayerInfo[playerid][pPcarkey2] == result) { } else { SendClientMessage(playerid, COLOR_GREY, " Trunk is locked !"); return 1; } } if(IsAPlane(result) || IsABike(result) || IsAOBike(result) || IsABoat(result) || IsAPizzabike(result) || IsABus(result) || IsATowcar(result) || IsAHarvest(result) || IsADrugHarvest(result) || IsASweeper(result) || result >=78 && result <= 83 || GetVehicleModel(GetPlayerVehicleID(result)) == 523) { SendClientMessage(playerid, COLOR_GREY, " This vehicle doesn't have the trunk !"); return 1; } if(vehTrunkCounter[result] != 0) { ReduceTime[playerid] = 1; SetTimerEx("ReduceTimer", 3000, false, "i", playerid); new buffer[128]; new gunName[100]; SafeGivePlayerWeapon(playerid, vehTrunk[result][vehTrunkCounter[result]], vehTrunkAmmo[result][vehTrunkCounter[result]]); GetWeaponName(vehTrunk[result][vehTrunkCounter[result]], gunName, sizeof(gunName)); format(buffer, sizeof(buffer), "You've taken a %s (Ammo: %i) from the vehicle.", gunName, vehTrunkAmmo[result][vehTrunkCounter[result]]); SendClientMessage(playerid, COLOR_WHITE, buffer); vehTrunk[result][vehTrunkCounter[result]] = '\0'; vehTrunkAmmo[result][vehTrunkCounter[result]] = '\0'; vehTrunkCounter[result]--; format(string, sizeof(string), "* %s opens car's trunk and takes a weapon.", sendername); ProxDetector(30.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5); SaveTrunk(); return 1; } else { SendClientMessage(playerid, COLOR_GREY, " Trunk is empty ! "); return 1; } } default: { SendClientMessage(playerid, COLOR_GREY, " Found more then one car in range"); return 1; } } return 1; } else if(strcmp(x_nr,"putarmour",true) == 0) { new counter = 0; new result; new plyName[MAX_PLAYER_NAME]; GetPlayerName(playerid, plyName, MAX_PLAYER_NAME); for(new i; i != MAX_VEHICLES; i++) { new dist = CheckPlayerDistanceToVehicle(3.5, playerid, i); if(dist) { result = i; counter++; } } switch(counter) { case 0: { SendClientMessage(playerid, COLOR_GREY, " No cars with trunk near you"); return 1; } case 1: { if(IsPlayerInAnyVehicle(playerid)) { SendClientMessage(playerid, COLOR_GREY, " You can't open the trunk while you're in the car"); return 1; } if(IsAnOwnableCar(result)) { if(PlayerInfo[playerid][pPcarkey] == result) { } else if(PlayerInfo[playerid][pPcarkey2] == result) { } else { SendClientMessage(playerid, COLOR_GREY, " Trunk is locked !"); return 1; } } if(IsAPlane(result) || IsABike(result) || IsAOBike(result) || IsABoat(result) || IsAPizzabike(result) || IsABus(result) || IsATowcar(result) || IsAHarvest(result) || IsADrugHarvest(result) || IsASweeper(result) || result >=78 && result <= 83 || GetVehicleModel(GetPlayerVehicleID(result)) == 523) { SendClientMessage(playerid, COLOR_GREY, " This vehicle doesn't have the trunk !"); return 1; } new Float:plyArmour; GetPlayerArmour(playerid, plyArmour); if(plyArmour != 0) { SafeSetPlayerArmour(playerid, 0); vehTrunkArmour[result] = plyArmour; format(string, sizeof(string), "* %s takes off his/her body armour and puts it into car trunk.", sendername); ProxDetector(30.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5); SaveTrunk(); return 1; } else { SendClientMessage(playerid, COLOR_GREY, " You haven't got any armour "); return 1; } } default: { SendClientMessage(playerid, COLOR_GREY, " Found more then one car in range"); return 1; } } return 1; } else if(strcmp(x_nr,"takearmour",true) == 0) { new counter = 0; new result; new plyName[MAX_PLAYER_NAME]; GetPlayerName(playerid, plyName, MAX_PLAYER_NAME); for(new i; i != MAX_VEHICLES; i++) { new dist = CheckPlayerDistanceToVehicle(3.5, playerid, i); if(dist) { result = i; counter++; } } switch(counter) { case 0: { SendClientMessage(playerid, COLOR_GREY, " No cars with trunk near you"); return 1; } case 1: { if(IsPlayerInAnyVehicle(playerid)) { SendClientMessage(playerid, COLOR_GREY, " You can't open the trunk while you're in the car"); return 1; } if(IsAnOwnableCar(result)) { if(PlayerInfo[playerid][pPcarkey] == result) { } else if(PlayerInfo[playerid][pPcarkey2] == result) { } else { SendClientMessage(playerid, COLOR_GREY, " Trunk is locked !"); return 1; } } if(IsAPlane(result) || IsABike(result) || IsAOBike(result) || IsABoat(result) || IsAPizzabike(result) || IsABus(result) || IsATowcar(result) || IsAHarvest(result) || IsADrugHarvest(result) || IsASweeper(result) || result >=78 && result <= 83 || GetVehicleModel(GetPlayerVehicleID(result)) == 523) { SendClientMessage(playerid, COLOR_GREY, " This vehicle doesn't have the trunk !"); return 1; } if(vehTrunkArmour[result] != 0) { SafeSetPlayerArmour(playerid, vehTrunkArmour[result]); vehTrunkArmour[result] = 0; format(string, sizeof(string), "* %s takes out the body armour from the trunk and puts it on.", sendername); ProxDetector(30.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5); SaveTrunk(); return 1; } else { SendClientMessage(playerid, COLOR_GREY, " There are no body armour in the trunk ! "); return 1; } } default: { SendClientMessage(playerid, COLOR_GREY, " Found more then one car in range"); return 1; } } return 1; } else if(strcmp(x_nr,"frisk",true) == 0) { if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1 || PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pLeader] == 2) { new counter = 0; new result; new plyName[MAX_PLAYER_NAME]; GetPlayerName(playerid, plyName, MAX_PLAYER_NAME); for(new i; i != MAX_VEHICLES; i++) { new dist = CheckPlayerDistanceToVehicle(3.5, playerid, i); if(dist) { result = i; counter++; } } switch(counter) { case 0: { SendClientMessage(playerid, COLOR_GREY, " No cars with trunk near you"); } case 1: { if(IsPlayerInAnyVehicle(playerid)) { SendClientMessage(playerid, COLOR_GREY, " You can't open the trunk while you're in the car"); return 1; } if(IsAPlane(result) || IsABike(result) || IsAOBike(result) || IsABoat(result) || IsAPizzabike(result) || IsABus(result) || IsATowcar(result) || IsAHarvest(result) || IsADrugHarvest(result) || IsASweeper(result) || result >=78 && result <= 83 || GetVehicleModel(GetPlayerVehicleID(result)) == 523) { SendClientMessage(playerid, COLOR_GREY, " This vehicle doesn't have the trunk !"); return 1; } SendClientMessage(playerid, COLOR_LIGHT_BLUE, "|_______ Vehicle Trunk _______|"); for(new slot = 1; slot != MAX_TRUNK_SLOTS; slot++) { new gunname[100]; if(vehTrunk[result][slot] != 0) { GetWeaponName(vehTrunk[result][slot], gunname, sizeof(gunname)); format(string, sizeof(string), "| Slot %i: %s (Ammo: %i)", slot, gunname, vehTrunkAmmo[result][slot]); SendClientMessage(playerid, COLOR_WHITE, string); } else { format(string, sizeof(string), "| Slot %i: Empty (Ammo: N/A)", slot); SendClientMessage(playerid, COLOR_WHITE, string); } } format(string, sizeof(string), "| Body armour: %f%", vehTrunkArmour[result]); SendClientMessage(playerid, COLOR_WHITE, string); format(string, sizeof(string), "* %s opens the trunk and checks what is inside.", sendername); ProxDetector(30.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5); return 1; } default: { SendClientMessage(playerid, COLOR_GREY, " Found more then one car in range"); return 1; } } } else { SendClientMessage(playerid, COLOR_GREY, " You're not the cop ! "); return 1; } return 1; } else { SendClientMessage(playerid, COLOR_WHITE, "HINT: /trunk [name]"); SendClientMessage(playerid, COLOR_WHITE, "Available names: info, putgun, takegun, putarmour, takearmour"); if(PlayerInfo[playerid][pLeader] == 1 || PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 2 || PlayerInfo[playerid][pMember] == 2) { SendClientMessage(playerid, COLOR_WHITE, "You can /trunk frisk as a cop"); } return 1; } } return 1; } if(!strcmp(cmdtext, "/windows", true) || !strcmp(cmdtext, "/wi", true)) // By LordMan { if(IsPlayerConnected(playerid)) { if(gPlayerLogged[playerid] == 0) { SendClientMessage(playerid, COLOR_GREY, " You need to login first ! "); return 1; } new playercar = GetPlayerVehicleID(playerid); if(IsPlayerInAnyVehicle(playerid)) { if(IsModelAPlane(playercar) || IsModelABike(playercar) || IsModelAHeli(playercar) || IsModelABoat(playercar) || IsModelASpecial(playercar)) { SendClientMessage(playerid, COLOR_GREY, " This vehicle doesn't have the window to roll"); return 1; } if(VehicleWindows[playercar] == 0) { VehicleWindows[GetPlayerVehicleID(playerid)] = 1; format(string, sizeof(string), "* %s rolls down the window.", sendername); ProxDetector(30.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5); return 1; } else if(VehicleWindows[playercar] == 1) { VehicleWindows[GetPlayerVehicleID(playerid)] = 0; format(string, sizeof(string), "* %s rolls up the window.", sendername); ProxDetector(30.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5); return 1; } new y, m, d; new h,mi,s; getdate(y,m,d); gettime(h,mi,s); format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /windows",d,m,y,h,mi,s,sendername); CommandLog(string); return 1; } else { SendClientMessage(playerid, COLOR_GREY, " You need to be in the vehicle to use this function !"); return 1; } } return 1; }