if(strcmp(cmd, "/comprar-auto", true) == 0) { if(IsPlayerConnected(playerid)) { new vehicle; vehicle = strval(tmp); tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GRAD2, "{FFFF00}Use:{FFFFFF} /comprar-auto [ID]"); return 1; } new vehicleprice; if(PlayerToPoint(3.0, playerid,1629.6888,-1903.3663,13.5530)) { if(vehicle == 445) { vehicleprice = 25000; } else if(vehicle == 542) { vehicleprice = 130000; } else if(vehicle == 466) { vehicleprice = 60000; } else if(vehicle == 504) { vehicleprice = 45000; } else if(vehicle == 507) { vehicleprice = 50000; } else if(vehicle == 51 { vehicleprice = 70000; } else if(vehicle == 527) { vehicleprice = 75000; } else if(vehicle == 543) { vehicleprice = 79000; } else if(vehicle == 567) { vehicleprice = 80000; } else { SendClientMessage(playerid,COLOR_GREY,"Nosotros no vendemos ese modelo."); return 1; } } else { SendClientMessage(playerid, COLOR_RED, "No estas en un concecionario."); return 1; } if(vehicleprice == 0) { return 1; } if(GetPlayerPCash(playerid) < vehicleprice) { SendClientMessage(playerid,COLOR_GREY,"No tienes suficiente dinero"); return 1; } new found = 0; for(new i = 0; i < sizeof(CarInfo); i++) //for(new i = 0; i < sizeof(CarInfo); i++) { if(found != 1) { if(CarInfo[i][cOwned] == 0) { found = 1; CarInfo[i][cMod][0] = 0; CarInfo[i][cMod][1] = 0; CarInfo[i][cMod][2] = 0; CarInfo[i][cMod][3] = 0; CarInfo[i][cMod][4] = 0; CarInfo[i][cMod][5] = 0; CarInfo[i][cMod][6] = 0; CarInfo[i][cMod][7] = 0; CarInfo[i][cMod][8] = 0; CarInfo[i][cMod][9] = 0; if(PlayerInfo[playerid][pCarkey] == SCRIPT_CARS) { PlayerInfo[playerid][pCarkey] = i; } else if(PlayerInfo[playerid][pCarkey2] == SCRIPT_CARS) { PlayerInfo[playerid][pCarkey2] = i; } else if(PlayerInfo[playerid][pCarkey3] == SCRIPT_CARS) { PlayerInfo[playerid][pCarkey3] = i; } GivePlayerPCash(playerid,-vehicleprice); CarInfo[i][cOwned] = 1; CarInfo[i][cModel] = vehicle; format(string, sizeof(string), "%s",VehicleName[vehicle-400]); strmid(CarInfo[i][cDescription], string, 0, strlen(string), 255); CarInfo[i][cValue] = vehicleprice; CarInfo[i][cColorOne] = 244; CarInfo[i][cColorTwo] = 244; CarInfo[i][cLock] = 0; CarInfo[i][cLocationx] = 1649.5106; CarInfo[i][cLocationy] = -1885.5503; CarInfo[i][cLocationz] = 13.2243; CarInfo[i][cAngle] = 359.4385; CarInfo[i][cDonate] = 0; CarInfo[i][cFuel] = 100; GetPlayerName(playerid, sendername, sizeof(sendername)); format(string, sizeof(string), "%s", sendername); strmid(CarInfo[i][cOwner], string, 0, strlen(string), 255); new carid = AddStaticVehicleEx(CarInfo[i][cModel],1649.5106,-1885.5503,13.2243+1,359.4385,244,244,3600); VehicleOwned[carid] = i; //SaveCars(); OnPlayerDataSave(playerid); return 1; } } } if(found != 1) { SendClientMessage(playerid, COLOR_WHITE, "No hay mas carros en venta."); } } return 1; } |
if(PlayerToPoint(3.0, playerid,1629.6888,-1903.3663,13.5530))
{
switch(vehicle)
{
case 445: vehicleprice = 25000;
case 542: vehicleprice = 130000;
case 466: vehicleprice = 60000;
case 504: vehicleprice = 45000;
case 507: vehicleprice = 50000;
case 51: vehicleprice = 70000;
case 527: vehicleprice = 75000;
case 543: vehicleprice = 79000;
case 567: vehicleprice = 80000;
default: return SendClientMessage(playerid,COLOR_GREY,"Nosotros no vendemos ese modelo.");
}
}
pawn Код:
|
tmp = strtok(cmdtext, idx);
vehicle = strval(tmp);