18.05.2015, 22:21
Hello guys i am on my way on making an nise dialog-based dynamic dealership.
Right now im making a basic command [ / buyinfernus ] to see if it is working.
This is the CMD :
The problem is that,i want tha car owner to be the one that types /buyinfernus....the problem is that the car is created,but the owner its not set...everyone can drive it..
Please guys,i need tips on how to make it work.
Right now im making a basic command [ / buyinfernus ] to see if it is working.
This is the CMD :
PHP код:
// comanda buy infernus//
if(strcmp(cmd, "/buyinfernus", true) == 0)
{
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);
// 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;
}
}
Please guys,i need tips on how to make it work.