08.04.2013, 10:18
Ok, i repost this topic since last was deleted for some reasons (?), my problem is: I've scripted a vehicle sell but im stucked at the selling part. I've a checkpoint and a check to see if the player is in the vehicle:
1st problem: I tried to enter without vehicle in the checkpoint and i dont get the "You must be in a car to sell one!".
2nd problem: Even if i try with a vehicle and i press 2, it doesnt show me the sell message. This is OnPlayerKeyStateChange:
Someone can tell me whats wrong?
pawn Код:
if(checkpointid == CPs[5]) //Vehicle Sell Cp At Crane
{
if(!IsPlayerInAnyVehicle(playerid)) return SCM(playerid, 0xF60000AA, "You must be in a car to sell one!");
if(pInfo[playerid][Skill] == 7)
{
SCM(playerid,0xC93CCE00,"To sell this vehicle, press 2.");
IsAtSellingCraneCp[playerid] = 1;
}
}
2nd problem: Even if i try with a vehicle and i press 2, it doesnt show me the sell message. This is OnPlayerKeyStateChange:
pawn Код:
if(IsPlayerInAnyVehicle(playerid))
{
if(GetPVarInt(playerid,"SellTime")>GetTickCount())return SCM(playerid,0xFF0000FF,"Please wait 10 minutes before selling a vehicle again.");
if(newkeys & KEY_SUBMISSION && IsAtSellingCraneCp[playerid] == 1 && pInfo[playerid][Skill] == 7)
{
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
new rando = random(42381)+127;
new sold[128];
format(sold, sizeof(sold), "** %s sold for %d CSCash, thank you!", VehicleNames[GetVehicleModel(GetPlayerVehicleID(playerid))-400],rando);
SCM(playerid, LIGHTBLUE, sold);
GivePlayerMoney(playerid, rando);
new irc[200];
format(irc,sizeof(irc), "2,7** Carjacker %s (%d) sold a %s for %d CSCash.",pname,playerid,VehicleNames[GetVehicleModel(GetPlayerVehicleID(playerid))-400],rando);
IRC_GroupSay(gGroupID, IRC_CHANNEL, irc);
SetPVarInt(playerid,"SellTime",GetTickCount()+600000);
RemovePlayerFromVehicle(playerid);
}
}