[SOLVED] Lock. :D -
coole210 - 21.08.2009
Okay my house system works fine, and my /buy and /sell works for 1 car, but when theres 2 cars and i /buy ID 1 it works
Then player buys ID 2 it says i own ID 2 now. Owner = player and my car owner = Coole210 but when i do /lockmycar 1 or 0 it says i must be inside my car to lock it when im inside my car, i go into ID 2 and it works, i do /whereismycar and it makes a checkpoint at ID 2
So really, it says ID 2 is my car, and carkeys are messed up too, it says Carkey=1 for me and the player, so we own same car, the other player can lock his and can /whereismycar and it makes checkpoint for his car, weird.. Then i add 3rd car, and all 3 of us control ID 3...
What's problem?
NOTE: I cannot show any script right now as i am on my laptop, i will edit when i can, what do you think is the problem? ( i am using
this guys buy, sell and locate cmd, the enums and saving/loading is by me

)
NOTE#2: I edited
^^^^^^^^^^^^^^^ commands to /buy /sell and /whereismycar rather then /carbuy /car sell and /car locate If that helps
Re: Car system bug -
coole210 - 21.08.2009
pawn Код:
if(strcmp(cmd, "/sell", true) == 0)
{
if(IsPlayerConnected(playerid))
{
new playername[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername, sizeof(playername));
if(PlayerInfo[playerid][pCarKey] == 255)
{
SendClientMessage(playerid, COLOR_GREY, "You don't own a car.");
return 1;
}
if(PlayerInfo[playerid][pCarKey] != 255 && strcmp(playername, Cars[PlayerInfo[playerid][pCarKey]][cOwner], true) == 0)
{
new car = PlayerInfo[playerid][pCarKey];
Cars[car][cOwned] = 0;
GetPlayerName(playerid, sendername, sizeof(sendername));
strmid(Cars[car][cOwner], "None", 0, strlen("None"), 256);
GivePlayerRcash(playerid,Cars[car][cPrice]);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
SendClientMessage(playerid,COLOR_GREEN,"[ ! ] Sold !");
PlayerInfo[playerid][pCarKey] = 255;
return 1;
}
}
return 1;
}
if(strcmp(cmd, "/whereismycar", true) == 0)
{
if(!IsPlayerConnected(playerid)) { return 1; }
if(PlayerInfo[playerid][pCarKey] == 255) { SendClientMessage(playerid,c_r,"[ ! ] You dont have a car to locate!"); return 1; }
if(cartrack[playerid]==0)
{
SetPlayerCheckpoint(playerid,Cars[PlayerInfo[playerid][pCarKey]][cX], Cars[PlayerInfo[playerid][pCarKey]][cY], Cars[PlayerInfo[playerid][pCarKey]][cZ], 4);
cartrack[playerid] = 1;
return 1;
}
else
{
cartrack[playerid] = 0;
return 1;
}
}
if(strcmp(cmd, "/buy", true) == 0)
{
if(IsPlayerConnected(playerid))
{
for(new i = 0; i < sizeof(Cars); i++)
{
if(Cars[i][ownedvehicle] == vehid)
{
if(PlayerInfo[playerid][pCarKey]!=255)
{
SendClientMessage(playerid, c_r, "You already own a car, type /sell if you want to buy this one!");
return 1;
}
if(Cars[i][cOwned]==1)
{
SendClientMessage(playerid, c_r, "[ ! ] Someone already owns this car");
return 1;
}
if(GetPlayerRcash(playerid) >= Cars[i][cPrice])
{
PlayerInfo[playerid][pCarKey] = Cars[i][cCarID];
Cars[i][cOwned] = 1;
GetPlayerName(playerid, sendername, sizeof(sendername));
strmid(Cars[i][cOwner], sendername, 0, strlen(sendername), 255);
GivePlayerRcash(playerid,-Cars[i][cPrice]);
SendClientMessage(playerid,COLOR_GREEN,"[ ! ] You have successfully purchased this vehicle !");
SaveCars();
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY, "[ ! ] You don't have the rcash for that!");
return 1;
}
}
}
}
return 1;
}
Help please, i just tested and noticed that players SWITCh cars, my friend bought a cheetah and did /whereismycar and it located my car, and i located his car, and then i tried to /sell it didnt work >.>
NOTE: I just changed PlayerInfo[playerid][pCarKey] = i; to PlayerInfo[playerid][pCarKey] = Cars[i][cCarID];
Re: Car system bug -
coole210 - 21.08.2009
( over 12 hours ![ithink])
mmkay i figured out problem ! its the carkeys thats messing up ! Instead of 1,2,3,4,5,6,7,8,9,10 it just does 0 or 1... Whats problem ?! My saving system is fine because house keys go up from 1 normally but my car keys just stay at 0 or 1! Whats problem ? [^^^^^^ script above ^^^^^^]
Somebody please help!
EDIT: fixed lock topic and close it !