08.07.2012, 01:14
Hello, I've been scripting for a while now I guess, and have never had this problem before. I've had this problem with ALL my commands at once, but not on a single one alone.
To me this command looks just fine, but maybe you guys could help me a bit?
To me this command looks just fine, but maybe you guys could help me a bit?
pawn Code:
if(strcmp(cmd, "/asellcar", true) == 0)
{
if(PlayerInfo[playerid][pAdmin] > 5)
{
new vehid;
vehid = GetPlayerVehicleID(playerid);
new CarQuery[100];
new OwnerName[MAX_PLAYER_NAME];
OwnerName = CarInfo[vehid][cOwner];
new Owner = ReturnUser(OwnerName);
new Value = CarInfo[vehid][cValue];
if(gPlayerLogged[Owner] != 0)
{
PlayerInfo[Owner][pPcarkey] = 999;
PlayerInfo[Owner][pAccount] += CarInfo[vehid][cValue];
SendClientMessage(Owner, COLOR_INFO, "* Your vehicle was sold by and admin. Your money has been wired to your bank account.");
}
else
{
format(CarQuery, sizeof(CarQuery), "UPDATE `Players` SET `Car`=999, `Bank`=%d WHERE `Name`=`%s`", PlayerInfo[Owner][pAccount] + Value, CarInfo[vehid][cOwner]);
mysql_query(CarQuery);
}
CarInfo[vehid][cOwned] = 0;
strmid(CarInfo[vehid][cOwner], "Dealership", 0, strlen("Dealership"), 999);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
GameTextForPlayer(playerid, "~w~You have admin sold the vehicle", 10000, 3);
CarInfo[vehid][cLocationx] = CarInfo[vehid][cSellLocationx];
CarInfo[vehid][cLocationy] = CarInfo[vehid][cSellLocationy];
CarInfo[vehid][cLocationz] = CarInfo[vehid][cSellLocationz];
CarInfo[vehid][cAngle] = CarInfo[vehid][cSellAngle];
RemovePlayerFromVehicle(playerid);
TogglePlayerControllable(playerid, 1);
SaveCars(vehid, 2);
DestroyVehicle(vehid);
CreateVehicle(CarInfo[vehid][cModel], CarInfo[vehid][cLocationx], CarInfo[vehid][cLocationy], CarInfo[vehid][cLocationz]+1.0, CarInfo[vehid][cAngle], CarInfo[vehid][cColorOne], CarInfo[vehid][cColorTwo], 60000);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_RED, "* You are not authorized to use that command.");
}
return 1;
}