09.07.2012, 10:30
Hello,
i have problem. After i disconnect from the server it saves my position fine
i'm in Unity Station, and my skin id is 19, when i come back it spawns me in Santa Maria Beach
with skin id 299. When i remove AddPlayerClass, it spawn me as CJ, and still it spawn me in Santa Maria Beach.
How can i fix this?
i make sure that pX, pY, pZ are Float. and i make sure that pInt and pWorld is Integer.
i have problem. After i disconnect from the server it saves my position fine
i'm in Unity Station, and my skin id is 19, when i come back it spawns me in Santa Maria Beach
with skin id 299. When i remove AddPlayerClass, it spawn me as CJ, and still it spawn me in Santa Maria Beach.
How can i fix this?
i make sure that pX, pY, pZ are Float. and i make sure that pInt and pWorld is Integer.
pawn Код:
public LoadUser_data(playerid, name[], value[])
{
INI_String("Password", PlayerInfo[playerid][pPass], 129);
INI_Int("Tutorial", PlayerInfo[playerid][pJoin]);
INI_Int("Selected", PlayerInfo[playerid][pSelected]);
INI_Int("Level", PlayerInfo[playerid][pLevel]);
INI_Int("Continent", PlayerInfo[playerid][pPlace]);
INI_Float("X", PlayerInfo[playerid][pX]);
INI_Float("Y", PlayerInfo[playerid][pY]);
INI_Float("Z", PlayerInfo[playerid][pZ]);
INI_Int("Interior", PlayerInfo[playerid][pInt]);
INI_Int("World", PlayerInfo[playerid][pWorld]);
INI_Int("Cash", PlayerInfo[playerid][pCash]);
INI_Int("Admin", PlayerInfo[playerid][pAdmin]);
INI_Int("Age", PlayerInfo[playerid][pAge]);
INI_Int("Gender", PlayerInfo[playerid][pGender]);
INI_Int("Origin", PlayerInfo[playerid][pOrigin]);
INI_Int("Model", PlayerInfo[playerid][pModel]);
INI_Int("DriveLic", PlayerInfo[playerid][pDriveLic]);
INI_Int("Place", PlayerInfo[playerid][pPlace]);
INI_Int("Exp", PlayerInfo[playerid][pExp]);
INI_Int("CellNo", PlayerInfo[playerid][pNumber]);
INI_Int("Helper", PlayerInfo[playerid][pHelper]);
INI_Int("Warns", PlayerInfo[playerid][pWarns]);
INI_Int("Muted", PlayerInfo[playerid][pMuted]);
INI_Int("MuteTime", PlayerInfo[playerid][pMuteTime]);
INI_Int("Vip", PlayerInfo[playerid][pVip]);
INI_Int("Spawn", PlayerInfo[playerid][pSpawn]);
INI_Int("Locked", PlayerInfo[playerid][pLocked]);
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
new buffer[129], str[128];
if(dialogid == INTRODUCTION)
{
if(!response) return Kick(playerid);
else if(response)
{
if(fexist(Path(playerid)))
{
INI_ParseFile(Path(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_INPUT, "Login", "Welcome come back in Resident's Life Roleplay\nPlease type your password to access your account!", "Login", "Quit");
}
else
{
ShowPlayerDialog(playerid, REGISTER, DIALOG_STYLE_INPUT, "Registering...", "Welcome to Resident's Life Roleplay\nPlease type your password to create new account!", "Register", "Quit");
}
}
}
if(dialogid == REGISTER)
{
if (!response) return Kick(playerid);
else if(response)
{
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, REGISTER, DIALOG_STYLE_INPUT, "Registering...", ""COL_RED"You have entered the field BLANK\n"COL_WHITE"Please type your password to create new account!", "Register", "Quit");
new INI:File = INI_Open(Path(playerid));
WP_Hash(buffer, sizeof(buffer), inputtext);
INI_SetTag(File, "data");
INI_WriteString(File, "Password", buffer);
INI_WriteInt(File, "Tutorial", PlayerInfo[playerid][pJoin] = 0);
INI_WriteInt(File, "Selected", PlayerInfo[playerid][pSelected]);
INI_WriteInt(File, "Level", PlayerInfo[playerid][pLevel] = 1);
SetPlayerScore(playerid, PlayerInfo[playerid][pLevel]);
INI_WriteFloat(File, "X", PlayerInfo[playerid][pX] = 1722.8942);
INI_WriteFloat(File, "Y", PlayerInfo[playerid][pY] = -1869.8459);
INI_WriteFloat(File, "Z", PlayerInfo[playerid][pZ] = 13.5646);
INI_WriteInt(File, "Interior", PlayerInfo[playerid][pInt] = 0);
INI_WriteInt(File, "World", PlayerInfo[playerid][pWorld] = 0);
INI_WriteInt(File, "Cash", PlayerInfo[playerid][pCash] = 100000);
SetPlayerCash(playerid, PlayerInfo[playerid][pCash]);
INI_WriteInt(File, "Admin", PlayerInfo[playerid][pAdmin] = 0);
INI_WriteInt(File, "Helper",PlayerInfo[playerid][pHelper] = 0);
INI_WriteInt(File, "Vip", PlayerInfo[playerid][pVip] = 0);
INI_WriteInt(File, "Spawn", PlayerInfo[playerid][pSpawn] = 1);
INI_WriteInt(File, "Model", PlayerInfo[playerid][pModel] = 23);
INI_WriteInt(File, "Locked", PlayerInfo[playerid][pLocked] = 0);
INI_WriteInt(File, "Age", PlayerInfo[playerid][pAge] = 0);
INI_WriteInt(File, "Gender", PlayerInfo[playerid][pGender] = 0);
INI_WriteInt(File, "Origin", PlayerInfo[playerid][pOrigin] = 0);
INI_WriteInt(File, "Respect", PlayerInfo[playerid][pExp] = 0);
INI_WriteInt(File, "Warns", PlayerInfo[playerid][pWarns] = 0);
INI_WriteInt(File, "Muted", PlayerInfo[playerid][pMuted] = 0);
INI_WriteInt(File, "MuteTime", PlayerInfo[playerid][pMuteTime] = 0);
new rp = 100000 + random(899999);
INI_WriteInt(File, "CellNo", PlayerInfo[playerid][pNumber] = rp);
INI_WriteInt(File, "DriveLic",PlayerInfo[playerid][pDriveLic] = 0);
INI_Close(File);
SetSpawnInfo(playerid, NO_TEAM, PlayerInfo[playerid][pModel], 1722.8942,-1869.8459,13.5646, 0, 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
SetPlayerSkin(playerid, PlayerInfo[playerid][pModel]);
ClearChat(playerid);
}
}
if(dialogid == LOGIN)
{
if(!response) return Kick(playerid);
else if(response)
{
WP_Hash(buffer, sizeof(buffer), inputtext);
if(strcmp(PlayerInfo[playerid][pPass], buffer, true) == 0)
{
SetSpawnInfo(playerid, NO_TEAM, PlayerInfo[playerid][pModel], PlayerInfo[playerid][pX], PlayerInfo[playerid][pY], PlayerInfo[playerid][pZ], 0, 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
PlayerInfo[playerid][pLog] = 1;
SetPlayerCash(playerid, PlayerInfo[playerid][pCash]);
SetPlayerScore(playerid, PlayerInfo[playerid][pLevel]);
ClearChat(playerid);
}
else
{
ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_INPUT, "Login", ""COL_RED"You have entered an incorrect password.\n"COL_WHITE"Please type your password to access your account!", "Login", "Quit");
}
}
}
if(dialogid == GENDER)
{
if(response)
{
if(listitem == 0)
{
PlayerInfo[playerid][pGender] = 1;
SendClientMessage(playerid, COLOR_YELLOW2, "So you are Male");
ShowPlayerDialog(playerid, AGE, DIALOG_STYLE_INPUT, "What is your age?", "How old are you?", "Next", "Leave Game");
}
else if(listitem == 1)
{
PlayerInfo[playerid][pGender] = 2;
SendClientMessage(playerid, COLOR_YELLOW2, "So you are Female");
ShowPlayerDialog(playerid, AGE, DIALOG_STYLE_INPUT, "What is your age?", "How old are you?", "Next", "Leave Game");
}
}
else
{
Kick(playerid);
}
}
if(dialogid == AGE)
{
if(response)
{
PlayerInfo[playerid][pAge] = strval(inputtext);
format(str, sizeof(str), "So you are %s years old", inputtext);
SendClientMessage(playerid, COLOR_YELLOW2, str);
if(strval(inputtext) <= 11)
{
SendClientMessage(playerid, COLOR_WHITE, "SERVER: This is a 12+ Only Server, Grow up and Come Back.");
Kick(playerid);
return 1;
}
if(strval(inputtext) >= 61)
{
SendClientMessage(playerid, COLOR_WHITE, "SERVER: Incorrect Age, You need to enter a Real Age.");
ShowPlayerDialog(playerid, AGE, DIALOG_STYLE_INPUT, "What is your age?", "How old are you?", "Next", "Leave Game");
return 1;
}
ShowPlayerDialog(playerid, CLOTHE, DIALOG_STYLE_INPUT, "Choose your clothe:", "Valid clothe: <1 to 299>", "Wear", "");
}
else
{
Kick(playerid);
}
}
if(dialogid == CLOTHE)
{
if(!response) return Kick(playerid);
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, CLOTHE, DIALOG_STYLE_INPUT, "Choose your clothe:", ""COL_RED"You have entered the field BLANK\n"COL_WHITE"Valid clothe: <1 to 299>", "War", "");
if(strval(inputtext) < 1 || strval(inputtext) > 299) return ShowPlayerDialog(playerid, CLOTHE, DIALOG_STYLE_INPUT, "Choose your clothe:", ""COL_RED"Invalid or Not usable clothe!\n"COL_WHITE"Valid clothe: <1 to 299>", "Wear", "");
PlayerInfo[playerid][pModel] = strval(inputtext);
SetPlayerSkin(playerid, PlayerInfo[playerid][pModel]);
format(str, sizeof(str), "You choose the clothe id %s", inputtext);
SendClientMessage(playerid, COLOR_YELLOW2, str);
new sexthings[] = "Europe\nAmerica\nAsia";
ShowPlayerDialog(playerid, CONTINENT, DIALOG_STYLE_LIST, "Where are you from?", sexthings, "Select", "Leave Game");
}
if(dialogid == CONTINENT)
{
if(response)
{
if (listitem == 0)
{
PlayerInfo[playerid][pPlace] = 1;
SendClientMessage(playerid, COLOR_YELLOW2, "So you are from the Europe.");
gPlayerRegStep[playerid] = 0;
PlayerInfo[playerid][pSelected] = 1;
}
else if (listitem == 1)
{
PlayerInfo[playerid][pPlace] = 2;
SendClientMessage(playerid, COLOR_YELLOW2, "So you are from United States (U.S).");
gPlayerRegStep[playerid] = 0;
PlayerInfo[playerid][pSelected] = 1;
}
else if (listitem == 2)
{
PlayerInfo[playerid][pPlace] = 3;
SendClientMessage(playerid, COLOR_YELLOW2, "So you are from Asia.");
gPlayerRegStep[playerid] = 0;
PlayerInfo[playerid][pSelected] = 1;
}
PlayerInfo[playerid][pLog] = 1;
TogglePlayerControllable(playerid, 1);
if(PlayerInfo[playerid][pJoin] == 0)
{
TogglePlayerControllable(playerid, 0);
PlayerInfo[playerid][pTut] = 1;
SetPlayerHealth(playerid, 100);
SetPlayerPos(playerid, 1412.8313, -1700.3066, 13.5395);
SetPlayerCameraPos(playerid, 1412.8313, -1700.3066, 13.5395);
SetPlayerCameraLookAt(playerid, 1412.8313, -1700.3066, 13.5395);
format(str, sizeof(str), "This is the Driving School, you will be able ~n~to take a drive test wich will cost you~n~100$ so you will get a Driving License.~n~REMEBER:The police stops you if you~n~don't have one.");
TextDrawSetString(Tutorial[playerid], str);
TextDrawShowForPlayer(playerid, Tutorial[playerid]);
SendClientMessage(playerid, COLOR_WHITE, "{248B10}Tutorial:{FFFFFF}Use SPACEBAR to continue, SHIFT to go back.");
}
}
else
{
Kick(playerid);
}
}
if(dialogid == DIALOG_ERROR)
{
ShowDialog(playerid, DialogReturn[playerid]);
return 1;
}
DialogReturn[playerid] = dialogid;
if(dialogid == DIALOG_VEHICLE)
{
if(response)
{
switch(listitem)
{
case 0:
{
new vehicleid = GetPlayerVehicleID(playerid);
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
if(engine == 0 && Fuel[vehicleid] <= 0)
{
ShowErrorDialog(playerid, "This vehicle is out of fuel!");
return 1;
}
if(engine == 1) { engine = 0; lights = 0; }
else { engine = 1; lights = 1; }
SetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
}
case 1:
{
new vehicleid = GetPlayerVehicleID(playerid);
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
if(lights == 1) lights = 0; else lights = 1;
SetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
}
case 2:
{
new vehicleid = GetPlayerVehicleID(playerid);
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
if(bonnet == 1) bonnet = 0; else bonnet = 1;
SetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
}
case 3:
{
new vehicleid = GetPlayerVehicleID(playerid);
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
if(boot == 1) boot = 0; else boot = 1;
SetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
}
case 4:
{
if(!GetPVarInt(playerid, "GasCan"))
{
ShowErrorDialog(playerid, "You don't have a gas can!");
return 1;
}
new vehicleid = GetPlayerVehicleID(playerid);
if(Fuel[vehicleid] < 80.0) Fuel[vehicleid] += 20.0;
else Fuel[vehicleid] = 100.0;
SetPVarInt(playerid, "GasCan", 0);
SendClientMessage(playerid, COLOR_WHITE, "You have filled the fuel tank with 20 fuel");
}
case 5:
{
new id = GetPVarInt(playerid, "DialogValue1");
if(GetPlayerVehicleAccess(playerid, id) < 2)
{
ShowErrorDialog(playerid, "You are not the owner of this vehicle!");
return 1;
}
new msg[128];
VehicleCreated[id] = 0;
new money = VehicleValue[id]/2;
GivePlayerMoney(playerid, money);
format(msg, sizeof(msg), "You have sold your vehicle for $%d", money);
SendClientMessage(playerid, COLOR_WHITE, msg);
RemovePlayerFromVehicle(playerid);
DestroyVehicle(VehicleID[id]);
SaveVehicle(id);
}
case 6:
{
new vehicleid = GetPVarInt(playerid, "DialogValue1");
if(GetPlayerVehicleAccess(playerid, vehicleid) < 2)
{
ShowErrorDialog(playerid, "You are not the owner of this vehicle!");
return 1;
}
GetVehiclePos(VehicleID[vehicleid], VehiclePos[vehicleid][0], VehiclePos[vehicleid][1], VehiclePos[vehicleid][2]);
GetVehicleZAngle(VehicleID[vehicleid], VehiclePos[vehicleid][3]);
VehicleInterior[vehicleid] = GetPlayerInterior(playerid);
VehicleWorld[vehicleid] = GetPlayerVirtualWorld(playerid);
SendClientMessage(playerid, COLOR_WHITE, "You have parked this vehicle here");
UpdateVehicle(vehicleid, 1);
PutPlayerInVehicle(playerid, VehicleID[vehicleid], 0);
SaveVehicle(vehicleid);
}
case 7:
{
ShowDialog(playerid, DIALOG_VEHICLE_PLATE);
}
}
}
return 1;
}
if(dialogid == DIALOG_VEHICLE_BUY)
{
if(response)
{
if(GetPlayerVehicles(playerid) >= MAX_PLAYER_VEHICLES)
{
ShowErrorDialog(playerid, "You can't buy any more vehicles! Max: " #MAX_PLAYER_VEHICLES );
return 1;
}
new id = GetPVarInt(playerid, "DialogValue1");
if(GetPlayerMoney(playerid) < VehicleValue[id])
{
ShowErrorDialog(playerid, "You don't have enough money to buy this vehicle!");
return 1;
}
new freeid = GetFreeVehicleID();
if(!freeid)
{
ShowErrorDialog(playerid, "Vehicle dealership is out of stock!");
return 1;
}
GivePlayerMoney(playerid, -VehicleValue[id]);
new dealerid = strval(VehicleOwner[id]);
VehicleCreated[freeid] = VEHICLE_PLAYER;
VehicleModel[freeid] = VehicleModel[id];
VehiclePos[freeid] = DealershipPos[dealerid];
VehicleColor[freeid] = VehicleColor[id];
VehicleInterior[freeid] = VehicleInterior[id];
VehicleWorld[freeid] = VehicleWorld[id];
VehicleValue[freeid] = VehicleValue[id];
GetPlayerName(playerid, VehicleOwner[freeid], sizeof(VehicleOwner[]));
VehicleNumberPlate[freeid] = DEFAULT_NUMBER_PLATE;
for(new d=0; d < sizeof(VehicleTrunk[]); d++)
{
VehicleTrunk[freeid][d][0] = 0;
VehicleTrunk[freeid][d][1] = 0;
}
for(new d=0; d < sizeof(VehicleMods[]); d++)
{
VehicleMods[freeid][d] = 0;
}
VehiclePaintjob[freeid] = 255;
VehicleLock[freeid] = 0;
VehicleAlarm[freeid] = 0;
UpdateVehicle(freeid, 0);
SaveVehicle(freeid);
new msg[128];
format(msg, sizeof(msg), "You have bought this vehicle for $%d", VehicleValue[id]);
SendClientMessage(playerid, COLOR_WHITE, msg);
}
else
{
new id = GetPVarInt(playerid, "DialogValue1");
if(GetPlayerVehicleAccess(playerid, id) < 1)
{
RemovePlayerFromVehicle(playerid);
}
}
return 1;
}
if(dialogid == DIALOG_VEHICLE_SELL)
{
if(response)
{
if(GetPlayerVehicles(playerid) >= MAX_PLAYER_VEHICLES)
{
ShowErrorDialog(playerid, "You can't buy any more vehicles! Max: " #MAX_PLAYER_VEHICLES );
return 1;
}
new targetid = GetPVarInt(playerid, "DialogValue1");
new id = GetPVarInt(playerid, "DialogValue2");
new price = GetPVarInt(playerid, "DialogValue3");
if(GetPlayerMoney(playerid) < price)
{
ShowErrorDialog(playerid, "You don't have enough money to buy this vehicle!");
return 1;
}
new msg[128];
GetPlayerName(playerid, VehicleOwner[id], sizeof(VehicleOwner[]));
GivePlayerMoney(playerid, -price);
GivePlayerMoney(targetid, price);
SaveVehicle(id);
format(msg, sizeof(msg), "You have bought this vehicle for $%d", price);
SendClientMessage(playerid, COLOR_WHITE, msg);
format(msg, sizeof(msg), "%s (%d) has accepted your offer and bought the vehicle", GetpName(playerid), playerid);
SendClientMessage(targetid, COLOR_WHITE, msg);
}
else
{
new targetid = GetPVarInt(playerid, "DialogValue1");
new msg[128];
format(msg, sizeof(msg), "%s (%d) refused your offer", GetpName(playerid), playerid);
SendClientMessage(targetid, COLOR_WHITE, msg);
}
return 1;
}
if(dialogid == DIALOG_FINDVEHICLE)
{
if(response)
{
new id;
sscanf(inputtext[4], "d", id);
if(IsValidVehicle(id))
{
TrackCar[playerid] = VehicleID[id];
SendClientMessage(playerid, COLOR_WHITE, "Your vehicle's location is shown on your minimap");
}
}
return 1;
}
if(dialogid == DIALOG_TRUNK)
{
if(response)
{
SetPVarInt(playerid, "DialogValue2", listitem);
ShowDialog(playerid, DIALOG_TRUNK_ACTION);
}
else
{
new id = GetPVarInt(playerid, "DialogValue1");
ToggleBoot(VehicleID[id], VEHICLE_PARAMS_OFF);
}
return 1;
}
if(dialogid == DIALOG_TRUNK_ACTION)
{
if(response)
{
new id = GetPVarInt(playerid, "DialogValue1");
new slot = GetPVarInt(playerid, "DialogValue2");
switch(listitem)
{
case 0:
{
new weaponid = GetPlayerWeapon(playerid);
if(weaponid == 0)
{
ShowErrorDialog(playerid, "You don't have a weapon in your hands!");
return 1;
}
VehicleTrunk[id][slot][0] = weaponid;
if(IsMeleeWeapon(weaponid)) VehicleTrunk[id][slot][1] = 1;
else VehicleTrunk[id][slot][1] = GetPlayerAmmo(playerid);
RemovePlayerWeapon(playerid, weaponid);
SaveVehicle(id);
}
case 1:
{
if(VehicleTrunk[id][slot][1] <= 0)
{
ShowErrorDialog(playerid, "This slot is empty!");
return 1;
}
GivePlayerWeapon(playerid, VehicleTrunk[id][slot][0], VehicleTrunk[id][slot][1]);
VehicleTrunk[id][slot][0] = 0;
VehicleTrunk[id][slot][1] = 0;
SaveVehicle(id);
}
}
}
ShowDialog(playerid, DIALOG_TRUNK);
return 1;
}
if(dialogid == DIALOG_VEHICLE_PLATE)
{
if(response)
{
if(strlen(inputtext) < 1 || strlen(inputtext) >= sizeof(VehicleNumberPlate[]))
{
ShowErrorDialog(playerid, "Invalid length!");
return 1;
}
new id = GetPVarInt(playerid, "DialogValue1");
new vehicleid = VehicleID[id];
strmid(VehicleNumberPlate[id], inputtext, 0, sizeof(VehicleNumberPlate[]));
SaveVehicle(id);
SetVehicleNumberPlate(vehicleid, inputtext);
SetVehicleToRespawn(vehicleid);
new msg[128];
format(msg, sizeof(msg), "You have changed vehicle number plate to %s", inputtext);
SendClientMessage(playerid, COLOR_WHITE, msg);
}
else ShowDialog(playerid, DIALOG_VEHICLE);
return 1;
}
if(dialogid == DIALOG_FUEL)
{
if(response)
{
switch(listitem)
{
case 0:
{
if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER)
{
ShowErrorDialog(playerid, "You are not driving a vehicle!");
return 1;
}
new vehicleid = GetPlayerVehicleID(playerid);
if(IsBicycle(vehicleid))
{
ShowErrorDialog(playerid, "Your vehicle doesn't have a fuel tank!");
return 1;
}
if(Fuel[vehicleid] >= 100.0)
{
ShowErrorDialog(playerid, "Your vehicle fuel tank is full!");
return 1;
}
if(GetPlayerMoney(playerid) < FUEL_PRICE)
{
ShowErrorDialog(playerid, "You don't have enough money!");
return 1;
}
RefuelTime[playerid] = 5;
SetPVarFloat(playerid, "Fuel", Fuel[vehicleid]);
GameTextForPlayer(playerid, "~w~refueling...", 2000, 3);
}
case 1:
{
if(GetPVarInt(playerid, "GasCan"))
{
ShowErrorDialog(playerid, "You already have a gas can!");
return 1;
}
if(GetPlayerMoney(playerid) < GAS_CAN_PRICE)
{
ShowErrorDialog(playerid, "You don't have enough money!");
return 1;
}
GivePlayerMoney(playerid, -GAS_CAN_PRICE);
SetPVarInt(playerid, "GasCan", 1);
SendClientMessage(playerid, COLOR_WHITE, "You have bought a gas can for $" #GAS_CAN_PRICE );
}
}
}
return 1;
}
if(dialogid == DIALOG_EDITVEHICLE)
{
if(response)
{
new id = GetPVarInt(playerid, "DialogValue1");
new nr, params[128];
sscanf(inputtext, "ds", nr, params);
switch(nr)
{
case 1:
{
new value = strval(params);
if(value < 0) value = 0;
VehicleValue[id] = value;
UpdateVehicleLabel(id, 1);
SaveVehicle(id);
ShowDialog(playerid, DIALOG_EDITVEHICLE);
}
case 2:
{
new value;
if(IsNumeric(params)) value = strval(params);
else value = GetVehicleModelIDFromName(params);
if(value < 400 || value > 611)
{
ShowErrorDialog(playerid, "Invalid vehicle model!");
return 1;
}
VehicleModel[id] = value;
for(new i=0; i < sizeof(VehicleMods[]); i++)
{
VehicleMods[id][i] = 0;
}
VehiclePaintjob[id] = 255;
UpdateVehicle(id, 1);
SaveVehicle(id);
ShowDialog(playerid, DIALOG_EDITVEHICLE);
}
case 3:
{
new color1, color2;
sscanf(params, "dd", color1, color2);
VehicleColor[id][0] = color1;
VehicleColor[id][1] = color2;
SaveVehicle(id);
ChangeVehicleColor(VehicleID[id], color1, color2);
ShowDialog(playerid, DIALOG_EDITVEHICLE);
}
case 4:
{
if(strlen(params) < 1 || strlen(params) > 8)
{
ShowErrorDialog(playerid, "Invalid length!");
return 1;
}
strmid(VehicleNumberPlate[id], params, 0, sizeof(params));
SaveVehicle(id);
SetVehicleNumberPlate(VehicleID[id], params);
SetVehicleToRespawn(VehicleID[id]);
ShowDialog(playerid, DIALOG_EDITVEHICLE);
}
case 5:
{
DestroyVehicle(VehicleID[id]);
if(VehicleCreated[id] == VEHICLE_DEALERSHIP)
{
Delete3DTextLabel(VehicleLabel[id]);
}
VehicleCreated[id] = 0;
SaveVehicle(id);
new msg[128];
format(msg, sizeof(msg), "You have deleted vehicle id %d", id);
SendClientMessage(playerid, COLOR_WHITE, msg);
}
case 6:
{
if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER)
{
ShowErrorDialog(playerid, "You are not driving the vehicle!");
return 1;
}
GetVehiclePos(VehicleID[id], VehiclePos[id][0], VehiclePos[id][1], VehiclePos[id][2]);
GetVehicleZAngle(VehicleID[id], VehiclePos[id][3]);
VehicleInterior[id] = GetPlayerInterior(playerid);
VehicleWorld[id] = GetPlayerVirtualWorld(playerid);
SendClientMessage(playerid, COLOR_WHITE, "You have parked this vehicle here");
UpdateVehicle(id, 1);
PutPlayerInVehicle(playerid, VehicleID[id], 0);
SaveVehicle(id);
ShowDialog(playerid, DIALOG_EDITVEHICLE);
}
case 7:
{
new Float:x, Float:y, Float:z;
GetVehiclePos(VehicleID[id], x, y, z);
SetPlayerPos(playerid, x, y, z+1);
new msg[128];
format(msg, sizeof(msg), "You have teleported to vehicle id %d", id);
SendClientMessage(playerid, COLOR_WHITE, msg);
}
}
}
return 1;
}
return 1;
}