19.05.2015, 15:36
(
Последний раз редактировалось PepsiCola23; 19.05.2015 в 17:18.
)
Hello guys ,right now i`m improving my dynamic dealership that i made almost from scrathch.
I made a basic comand [ /buyinfernus] to see if its working.
And i also made /v park /v color etc.
All of them work,except 1 thing: after i use one of those cmds[/buyinfernus , /v park , /v color etc] the time freezes for ~11 seconds,and then everything works fine.
I dont know why after one of those cmds ,the time stopps for 11 seconds.
I accept any tips,thanks in advance.
/buyinfernus cmd
And the v color/park etc cmds:
REMIND: everything works fine after those 11 seconds[not just for me,for the hole server] but i want to remove this time freeze/bug/stop .Thanks in advance.
I made a basic comand [ /buyinfernus] to see if its working.
And i also made /v park /v color etc.
All of them work,except 1 thing: after i use one of those cmds[/buyinfernus , /v park , /v color etc] the time freezes for ~11 seconds,and then everything works fine.
I dont know why after one of those cmds ,the time stopps for 11 seconds.
I accept any tips,thanks in advance.
/buyinfernus cmd
PHP код:
// comanda buy infernus//
if(strcmp(cmd, "/buyinfernus", true) == 0)
{
if(PlayerInfo[playerid][pPcarkey] == -1) { }
else if(PlayerInfo[playerid][pPcarkey2] == -1) { }
else if(PlayerInfo[playerid][pPcarkey3] == -1) { }
else { SendClientMessage(playerid, COLOR_GREY, "* Detii 3 masini!"); return 1; }
if(PlayerInfo[playerid][pLevel] >= 5 )
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "{00A1FF}USAGE:{C0C0C0} /buyinfernus [color1] [color2] ");
return 1;
}
// new car;
// car = strval(tmp);
// if(car < 411 || car > 411) { SendClientMessage(playerid, COLOR_WHITE, "{0950F7}*Aceasta este comanda de a cumpara infernus !"); return 1; }
// tmp = strtok(cmdtext, idx);
// if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_WHITE, "{00A1FF}USAGE:{C0C0C0} /buyinfernus"); return 1; }
new color1;
color1 = strval(tmp);
if(color1 < 0 || color1 > 126) { SendClientMessage(playerid, COLOR_WHITE, "{0950F7}* Color Number can't be below 0 or above 126 !"); return 1; }
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_WHITE, "{00A1FF}USAGE:{C0C0C0} /acreatecar [carid] [color1] [color2] [price]"); return 1; }
new color2;
color2 = strval(tmp);
if(color2 < 0 || color2 > 126) { SendClientMessage(playerid, COLOR_WHITE, "{0950F7}* Color Number can't be below 0 or above 126 !"); return 1; }
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_WHITE, "{00A1FF}USAGE:{C0C0C0} /acreatecar [carid] [color1] [color2] [price]"); return 1; }
new Float:X,Float:Y,Float:Z; GetPlayerPos(playerid, X,Y,Z);
new thiscar = CreateVehicle(411,X,Y,Z,1,color1,color2,99999999);
if(PlayerInfo[playerid][pPcarkey] == -1) { PlayerInfo[playerid][pPcarkey] = thiscar; }
else if(PlayerInfo[playerid][pPcarkey2] == -1) { PlayerInfo[playerid][pPcarkey2] = thiscar; }
else if(PlayerInfo[playerid][pPcarkey3] == -1) { PlayerInfo[playerid][pPcarkey3] = thiscar; }
else { return 1; }
// new value = strval(tmp);
CarInfo[thiscar][cModel] = 411; CarInfo[thiscar][cColorOne] = color1; CarInfo[thiscar][cColorTwo] = color2;
CarInfo[thiscar][cLocationx] = X; CarInfo[thiscar][cLocationy] = Y; CarInfo[thiscar][cLocationz] = Z; CarInfo[thiscar][cAngle] = 1;
CarInfo[thiscar][paintjob] = -1; LoadComponents(thiscar); PutPlayerInVehicle(playerid,thiscar,0);
CarInfo[thiscar][cOwned] = 1;
GetPlayerName(playerid, sendername, sizeof(sendername));
strmid(CarInfo[thiscar][cOwner], sendername, 0, strlen(sendername), 999);
GivePlayerMoney(playerid,-150000);
//Delete3DTextLabel(TextUpCar[idcar]);
OnCarUpdate(); SavePlayerData(playerid);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
GameTextForPlayer(playerid, "~w~Felicitari~n~ai platit 150k pentru infernus !", 5000, 3);
TogglePlayerControllable(playerid, 1);
return 1;
}
}
PHP код:
//==========================[/v(ehicle)]========================================
if(strcmp(cmd, "/v", true) == 0 || strcmp(cmd, "/vehicle", true) == 0)
{
if(IsPlayerConnected(playerid))
{
new x_nr[64];
x_nr = strtok(cmdtext, idx);
if(!strlen(x_nr))
{
SendClientMessage(playerid, COLOR_WHITE, "____________[Personal Vehicle Help]____________");
SendClientMessage(playerid, COLOR_WHITE, "** {1AFF00}(/v)ehicle {09DFF7}[name]");
SendClientMessage(playerid, COLOR_WHITE, "**buy, park, color, tow(1-3), fix(1-3), model");
return 1;
}
if(strcmp(x_nr,"park",true) == 0)
{
new Float:x,Float:y,Float:z;
new Float:a;
new carid;
new getcarid = GetPlayerVehicleID(playerid);
if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey]) { carid = PlayerInfo[playerid][pPcarkey]; }
else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey2]) { carid = PlayerInfo[playerid][pPcarkey2]; }
else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey3]) { carid = PlayerInfo[playerid][pPcarkey3]; }
else { return 1; }
GetPlayerName(playerid, playername, sizeof(playername));
GetVehiclePos(carid, x, y, z);
GetVehicleZAngle(carid, a);
if(IsPlayerInVehicle(playerid,carid) && CarInfo[carid][cOwned] == 1)
{
if(PlayerInfo[playerid][pPcarkey] == -1 && PlayerInfo[playerid][pPcarkey2] == -1 && PlayerInfo[playerid][pPcarkey3] == -1)
{
SendClientMessage(playerid, COLOR_GREY, "N ai o masina personala.");
return 1;
}
if(getcarid == carid)
{
new Float:CarHP, Float:OldCarHP; new panels,doors,lights,tires;
CarInfo[carid][cLocationx] = x;
CarInfo[carid][cLocationy] = y;
CarInfo[carid][cLocationz] = z;
CarInfo[carid][cAngle] = a;
GetVehicleDamageStatus(carid,panels,doors,lights,tires);
GetVehicleHealth(carid, CarHP); OldCarHP = CarHP;
OnCarUpdate(); DestroyVehicle(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);
// format(TextCar, sizeof(TextCar), "{EE1111}Owner: {0099FF}• %s •", CarInfo[carid][cOwner]);
// Update3DTextLabelText(TextUpCar[carid], 0x33AAFFFF, TextCar);
LoadComponents(carid);
SendClientMessage(playerid, COLOR_BLUE, "* Noua pozitie a fost salvata!");
SetVehicleHealth(carid, OldCarHP);
UpdateVehicleDamageStatus(carid, panels, doors, lights, tires);
return 1;
}
}
}
/* else if(strcmp(x_nr,"buy",true) == 0)
{
if(IsAnOwnableCar(idcar))
{
if(PlayerInfo[playerid][pPcarkey] == -1) { }
else if(PlayerInfo[playerid][pPcarkey2] == -1) { }
else if(PlayerInfo[playerid][pPcarkey3] == -1) { }
else { SendClientMessage(playerid, COLOR_GREY, "* Detii 3 masini!"); return 1; }
if(CarInfo[idcar][cOwned]==1)
{
SendClientMessage(playerid, COLOR_GREY, "Someone already owns this car.");
return 1;
}
if(GetPlayerMoney(playerid) >= CarInfo[idcar][cValue])
{
if(PlayerInfo[playerid][pPcarkey] == -1) { PlayerInfo[playerid][pPcarkey] = idcar; }
else if(PlayerInfo[playerid][pPcarkey2] == -1) { PlayerInfo[playerid][pPcarkey2] = idcar; }
else if(PlayerInfo[playerid][pPcarkey3] == -1) { PlayerInfo[playerid][pPcarkey3] = idcar; }
else { return 1; }
CarInfo[idcar][cOwned] = 1;
GetPlayerName(playerid, sendername, sizeof(sendername));
strmid(CarInfo[idcar][cOwner], sendername, 0, strlen(sendername), 999);
GivePlayerMoney(playerid,-CarInfo[idcar][cValue]);
Delete3DTextLabel(TextUpCar[idcar]);
//format(TextCar, sizeof(TextCar), "{EE1111}Owner: {0099FF}• %s •", CarInfo[idcar][cOwner]);
//TextUpCar[idcar] = Create3DTextLabel(TextCar, 0x33AAFFFF, 0.0, 0.0, 0.0, 25, 0, 1);
//Attach3DTextLabelToVehicle(TextUpCar[idcar], idcar, 0.0, 0.0, 0.1);
OnCarUpdate(); SavePlayerData(playerid);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
GameTextForPlayer(playerid, "~w~Felicitari~n~Nu uita sa o parchezi cu /v park !", 5000, 3);
TogglePlayerControllable(playerid, 1);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY, " You don't have enough cash with you!");
return 1;
}
}
} */
else if(strcmp(x_nr,"color",true) == 0)
{
if(PlayerInfo[playerid][pPcarkey] == -1 && PlayerInfo[playerid][pPcarkey2] == -1 && PlayerInfo[playerid][pPcarkey3] == -1)
{
SendClientMessage(playerid, COLOR_GREY," You don't have a Vehicle to respray.");
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;
}
if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey]) { vehid = PlayerInfo[playerid][pPcarkey]; }
else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey2]) { vehid = PlayerInfo[playerid][pPcarkey2]; }
else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey3]) { vehid = PlayerInfo[playerid][pPcarkey3]; }
else { return 1; }
if(IsPlayerInVehicle(playerid, vehid))
{
new Float:CarHP, Float:OldCarHP;
new panels, doors, lights, tires;
GetVehicleDamageStatus(vehid, panels, doors, lights, tires);
GetVehicleHealth(vehid, CarHP); OldCarHP = CarHP;
CarInfo[vehid][cColorOne] = color1;
CarInfo[vehid][cColorTwo] = color2;
GivePlayerMoney(playerid, -1000);
GameTextForPlayer(playerid, "~w~Masina Personala~n~~g~Revopsita cu succes~n~~r~$-100", 5000, 1);
ChangeVehicleColor(vehid, color1, color2);
SetVehicleToRespawn(vehid);
SetVehicleHealth(vehid, OldCarHP);
UpdateVehicleDamageStatus(vehid, panels, doors, lights, tires);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
OnCarUpdate();
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY," You are not in your Personal car.");
return 1;
}
}
/*else if(strcmp(x_nr,"locate1",true) == 0)
{
if(!IsPlayerConnected(playerid)) { return 1; }
new Float:x,Float:y,Float:z;
new car = PlayerInfo[playerid][pPcarkey];
if(PlayerInfo[playerid][pPcarkey]==-1) { GameTextForPlayer(playerid, "~w~Nu ai o masina pentru a putea fi localizata", 2500, 3); return 1; }
SendClientMessage(playerid,COLOR_WHITE,"Locatia masinii a fost gasita.");
GetVehiclePos(car, x, y, z);
SetPlayerCheckpoint(playerid, x, y, z, 6);
return 1;
}
else if(strcmp(x_nr,"locate2",true) == 0)
{
if(!IsPlayerConnected(playerid)) { return 1; }
new Float:x,Float:y,Float:z;
new car = PlayerInfo[playerid][pPcarkey2];
if(PlayerInfo[playerid][pPcarkey2]==-1) { GameTextForPlayer(playerid, "~w~Nu ai o masina pentru a putea fi localizata", 2500, 3); return 1; }
SendClientMessage(playerid,COLOR_WHITE,"Locatia masinii a fost gasita.");
GetVehiclePos(car, x, y, z);
SetPlayerCheckpoint(playerid, x, y, z, 6);
return 1;
}
else if(strcmp(x_nr,"locate3",true) == 0)
{
if(!IsPlayerConnected(playerid)) { return 1; }
new Float:x,Float:y,Float:z;
new car = PlayerInfo[playerid][pPcarkey3];
if(PlayerInfo[playerid][pPcarkey3]==-1) { GameTextForPlayer(playerid, "~w~Nu ai o masina pentru a putea fi localizata", 2500, 3); return 1; }
SendClientMessage(playerid,COLOR_WHITE,"Locatia masinii a fost gasita.");
GetVehiclePos(car, x, y, z);
SetPlayerCheckpoint(playerid, x, y, z, 6);
return 1;
}*/
else if(strcmp(x_nr,"tow1",true) == 0)
{
if(IsPlayerConnected(playerid))
{
new Float:CarHP, Float:OldCarHP;
new panels,doors,lights,tires;
new car = PlayerInfo[playerid][pPcarkey];
GetPlayerName(playerid, playername, sizeof(playername));
if (car != -1 && strcmp(playername, CarInfo[PlayerInfo[playerid][pPcarkey]][cOwner], true) == 0)
{
GetVehicleDamageStatus(car,panels,doors,lights,tires);
GetVehicleHealth(car, CarHP); OldCarHP = CarHP;
GameTextForPlayer(playerid, "~w~Masina personala~n~~g~Tractata cu succes~n~~r~$-1.500", 5000, 1);
GivePlayerMoney(playerid,-1500);
SetVehicleToRespawn(car);
SetVehicleHealth(car, OldCarHP);
UpdateVehicleDamageStatus(car, panels, doors, lights, tires);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
}
else
{
GameTextForPlayer(playerid, "~w~Nu detii o masina personala.", 5000, 1);
}
}
}
else if(strcmp(x_nr,"tow2",true) == 0)
{
if(IsPlayerConnected(playerid))
{
new Float:CarHP, Float:OldCarHP;
new panels,doors,lights,tires;
new car = PlayerInfo[playerid][pPcarkey2];
GetPlayerName(playerid, playername, sizeof(playername));
if (car != -1 && strcmp(playername, CarInfo[PlayerInfo[playerid][pPcarkey2]][cOwner], true) == 0)
{
GetVehicleDamageStatus(car,panels,doors,lights,tires);
GetVehicleHealth(car, CarHP); OldCarHP = CarHP;
GameTextForPlayer(playerid, "~w~Masina personala~n~~g~Tractata cu succes~n~~r~$-1.500", 5000, 1);
GivePlayerMoney(playerid,-1500);
SetVehicleToRespawn(car);
SetVehicleHealth(car, OldCarHP);
UpdateVehicleDamageStatus(car, panels, doors, lights, tires);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
}
else
{
GameTextForPlayer(playerid, "~w~Nu detii o masina personala.", 5000, 1);
}
}
}
else if(strcmp(x_nr,"tow3",true) == 0)
{
if(IsPlayerConnected(playerid))
{
new Float:CarHP, Float:OldCarHP;
new panels,doors,lights,tires;
new car = PlayerInfo[playerid][pPcarkey3];
GetPlayerName(playerid, playername, sizeof(playername));
if (car != -1 && strcmp(playername, CarInfo[PlayerInfo[playerid][pPcarkey3]][cOwner], true) == 0)
{
GetVehicleDamageStatus(car,panels,doors,lights,tires);
GetVehicleHealth(car, CarHP); OldCarHP = CarHP;
GameTextForPlayer(playerid, "~w~Masina personala~n~~g~Tractata cu succes~n~~r~$-1.500", 5000, 1);
GivePlayerMoney(playerid,-1500);
SetVehicleToRespawn(car);
SetVehicleHealth(car, OldCarHP);
UpdateVehicleDamageStatus(car, panels, doors, lights, tires);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
}
else
{
GameTextForPlayer(playerid, "~w~Nu detii o masina personala.", 5000, 1);
}
}
}
else if(strcmp(x_nr,"fix1",true) == 0)
{
if(IsPlayerConnected(playerid))
{
new car = PlayerInfo[playerid][pPcarkey];
GetPlayerName(playerid, playername, sizeof(playername));
if (car != -1 && strcmp(playername, CarInfo[PlayerInfo[playerid][pPcarkey]][cOwner], true) == 0)
{
GameTextForPlayer(playerid, "~w~Masina personala~n~~g~Reparata cu succes~n~~r~$-2.500", 5000, 1);
GivePlayerMoney(playerid,-2500);
SetVehicleToRespawn(car);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
}
else
{
GameTextForPlayer(playerid, "~w~Nu detii o masina personala.", 5000, 1);
}
}
}
else if(strcmp(x_nr,"fix2",true) == 0)
{
if(IsPlayerConnected(playerid))
{
new car = PlayerInfo[playerid][pPcarkey2];
GetPlayerName(playerid, playername, sizeof(playername));
if (car != -1 && strcmp(playername, CarInfo[PlayerInfo[playerid][pPcarkey2]][cOwner], true) == 0)
{
GameTextForPlayer(playerid, "~w~Masina personala~n~~g~Reparata cu succes~n~~r~$-2.500", 5000, 1);
GivePlayerMoney(playerid,-2500);
SetVehicleToRespawn(car);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
}
else
{
GameTextForPlayer(playerid, "~w~Nu detii o masina personala.", 5000, 1);
}
}
}
else if(strcmp(x_nr,"fix3",true) == 0)
{
if(IsPlayerConnected(playerid))
{
new car = PlayerInfo[playerid][pPcarkey3];
GetPlayerName(playerid, playername, sizeof(playername));
if (car != -1 && strcmp(playername, CarInfo[PlayerInfo[playerid][pPcarkey3]][cOwner], true) == 0)
{
GameTextForPlayer(playerid, "~w~Masina personala~n~~g~Reparata cu succes~n~~r~$-2.500", 5000, 1);
GivePlayerMoney(playerid,-2500);
SetVehicleToRespawn(car);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
}
else
{
GameTextForPlayer(playerid, "~w~Nu detii o masina personala.", 5000, 1);
}
}
}
else if(strcmp(x_nr,"x2x1x4x4x1",true) == 0)
{
new Float:x,Float:y,Float:z;
new carid;
new Float:a;
new Float:CarHP, Float:OldCarHP;
new panels,doors,lights,tires;
carid = GetPlayerVehicleID(playerid);
GetVehiclePos(carid, x, y, z);
GetVehicleZAngle(carid, a);
if(IsPlayerInVehicle(playerid,carid))
{
if(PlayerInfo[playerid][pDonateRank] < 3)
{
SCM(playerid, COLOR_GREY, "* Trebuie sa ai cont EXTRA VIP pentru acces la /v model!");
return 1;
}
if(GetPlayerMoney(playerid) < 5000)
{
SendClientMessage(playerid, COLOR_GREY,"Nu ai destui bani.");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SCM(playerid, COLOR_GREY, "USAGE: x");
return 1;
}
new model;
model = strval(tmp);
if(model < 400 || model > 611)
{
SCM(playerid, COLOR_GREY, "* x");
return 1;
}
else
{
//new tittle[128];
//new carkey = PlayerInfo[playerid][pPcarkey];
//format(tittle,128,"%s", CarInfo[carkey][cModel]);
//else
//{
CarInfo[carid][cModel] = model;
CarInfo[carid][cLocationx] = x;
CarInfo[carid][cLocationy] = y;
CarInfo[carid][cLocationz] = z;
CarInfo[carid][cAngle] = a;
//format(string, sizeof(string), "~n~ You changed Car's Model~n~");
GetVehicleDamageStatus(carid,panels,doors,lights,tires);
GetVehicleHealth(carid, CarHP); OldCarHP = CarHP;
OnCarUpdate(); DestroyVehicle(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);
LoadComponents(carid);
GivePlayerMoney(playerid, -5000);
SendClientMessage(playerid, COLOR_BLUE, "* Schimbarea modelului te-a costat $5.000!");
//format(string, sizeof(string), "~n~ You changed Car's Model~n~");
SetVehicleHealth(carid, OldCarHP);
UpdateVehicleDamageStatus(carid, panels, doors, lights, tires);
format(CarInfo[carid][cDescription], 32, "%s",vehName[model-400]);
return 1;
}
/*else
{
SCM(playerid, COLOR_GREY, "* Trebuie sa fi in masina pentru a utiliza comanda!");
return 1;
}*/
}
return 1;
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "____________[Personal Vehicle Help]____________");
SendClientMessage(playerid, COLOR_WHITE, "** {1AFF00}(/v)ehicle {09DFF7}[name]");
SendClientMessage(playerid, COLOR_WHITE, "**buy, park, color, tow(1-3), fix(1-3), model");
return 1;
}
}
return 1;
}