Sziasztok..
Van egy RP-s kocsi vásárlós Scriptem amit innen a forumról szedtem le.. De van egy kis baj vele... Még pedig ha bele megyek a Pickup-ba kijön a dialog kiválasztom az autót amit akarok és utána semmit nem csinál.. Se az autót nem adja le sem a pénzt nem vonja le..
Segítsetek PLS
:thumbsup:
#include <a_samp>
#define FILTERSCRIPT
#pragma tabsize 0
#define P_X 424.2530
#define P_Y 2456.8738
#define P_Z 16.6250
#define KI_X 402.8359
#define KI_Y 2466.7412
#define KI_Z 16.5159
#define KI_ROT 90.3151
#define DIALOGUE (1232)
new JarmuAdat[][] = { // A második szám az ár. az elsõ a model.
{ 400, 1500000 }, // Landstalker
{ 401, 1500000 }, // Bravura
{ 404, 8888 }, // Perennial
{ 410, 1500000 }, // Manana
{ 419, 1500000 }, // Esperanto
{ 421, 1500000 }, // Washington
{ 422, 1500000 }, // Bobcat
{ 426, 1500000 }, // Premier
{ 439, 1500000 }, // Stallion
{ 445, 15000000 }, // Admiral
{ 462, 120 }, // Faggio
{ 468, 100 }, // Sanchez
{ 475, 1500000 }, // Sabre
{ 478, 1500000 }, // Walton
{ 489, 1500000 }, // Rancher
{ 491, 1500000 }, // Virgo
{ 492, 1500000 }, // Greenwood
{ 518, 700000 }, // Buccaneer
{ 540, 1500000 } // Vincent
};
enum pdata { vehicle, vehileid }
enum vdata { Float:xpos, Float:ypos, Float:zpos, Float:rot, model, color1, color2, plate[32 + 1] }
new bool: Civilian[MAX_VEHICLES];
new IdeigID[MAX_PLAYERS];
new playerInfo[MAX_PLAYERS][pdata];
new vehicleInfo[MAX_VEHICLES][vdata];
new Pickup;
new SavedListitem[MAX_VEHICLES][64 + 1];
public OnFilterScriptInit( ) {
printf( \"[Fl0rian] Jármû vásárlás - BETÖLTVE\" );
LoadVehiclesFromFile( );
Pickup = CreatePickup( 1239, 1, P_X, P_Y, P_Z );
return 1;
}
public OnFilterScriptExit( ) {
printf( \"[Fl0rian] Jármû vásárlás - LEÁLLÍTVA\" );
DestroyPickup( Pickup );
return 1;
}
public OnPlayerPickUpPickup( playerid, pickupid ) {
if( pickupid == Pickup ) {
if( playerInfo[playerid][vehicle] == 1 ) return SendClientMessage( playerid, 0xff0000AA, \"HIBA: {ffffff}Neked már van autód.\" );
SetPlayerPos( playerid, P_X, P_Y+1, P_Z );
new dialText[512 + 1];
new tmp[64 + 1];
for( new i; i < sizeof JarmuAdat; i++ ) {
format( tmp, sizeof tmp, \"%s. Ár: %d$\\n\", GetVehicleModelName(JarmuAdat[0]), JarmuAdat[1] );
strins( dialText, tmp, strlen(dialText) );
format( SavedListitem, 64, \"%s\", GetVehicleModelName(JarmuAdat[0]) );
}
if( !strlen(dialText) ) return 1;
ShowPlayerDialog( playerid, DIALOGUE, DIALOG_STYLE_LIST, \"Autóvásárlás\", dialText, \"Tovább\", \"Kilép\" );
}
return 1;
}
public OnPlayerStateChange( playerid, newstate, oldstate ) {
if( newstate == PLAYER_STATE_DRIVER ) {
if( GetPlayerVehicleID(playerid) != playerInfo[playerid][vehileid] ) {
RemovePlayerFromVehicle( playerid );
return SendClientMessage( playerid, 0xff0000AA, \"HIBA: {ffffff}Ez a jármû nem a tiéd.\" );
}
}
return 1;
}
public OnPlayerExitVehicle( playerid, vehicleid ) {
new Float:x, Float:y, Float:z, Float:r;
GetVehiclePos( vehicleid, x, y, z );
GetVehicleZAngle( vehicleid, r );
if( GetPlayerState(playerid) == PLAYER_STATE_DRIVER && vehicleid == playerInfo[playerid][vehileid] ) {
DestroyVehicle( vehicleid );
playerInfo[playerid][vehileid] = CreateVehicle( vehicleInfo[playerInfo[playerid][vehileid]][model], x, y, z, r, vehicleInfo[playerInfo[playerid][vehileid]][color1], vehicleInfo[playerInfo[playerid][vehileid]][color2], 0 );
vehicleInfo[playerInfo[playerid][vehileid]][xpos] = x;
vehicleInfo[playerInfo[playerid][vehileid]][ypos] = y;
vehicleInfo[playerInfo[playerid][vehileid]][zpos] = z;
vehicleInfo[playerInfo[playerid][vehileid]][rot] = r;
new vname[64 + 1];
format( vname, 64, \"%03d.dat\", vehicleid );
new File: vfile = fopen(vname);
#define LustaVagyok(%0) vehicleInfo[playerInfo[playerid][vehileid]][%0]
if( vfile ) {
new vstring[128 + 1];
format( vstring, 128, \"%f,%f,%f,%f,%d,%d,%d,%s\", LustaVagyok(xpos), LustaVagyok(ypos), LustaVagyok(zpos), LustaVagyok(rot), LustaVagyok(color1), LustaVagyok(color2), LustaVagyok(model), LustaVagyok(plate) );
fwrite( vfile, vstring );
fclose( vfile );
}
}
return 1;
}
public OnDialogResponse( playerid, dialogid, response, listitem, inputtext[] ) {
switch( dialogid ) {
case DIALOGUE: {
if( GetPlayerMoney(playerid) < JarmuAdat[listitem][1] ) return SendClientMessage( playerid, 0xff0000AA, \"HIBA: {ffffff}Nincs pénzed erre a jármûre.\" );
IdeigID[playerid] = GetVehicleIDFromName( SavedListitem[listitem] );
new rand1 = random(255);
new rand2 = random(255);
new veh = CreateVehicle( IdeigID[playerid], KI_X, KI_Y, KI_Z, KI_ROT, rand1, rand2, 0 );
playerInfo[playerid][vehicle] = 1;
playerInfo[playerid][vehileid] = veh;
vehicleInfo[veh][xpos] = KI_X;
vehicleInfo[veh][ypos] = KI_Y;
vehicleInfo[veh][zpos] = KI_Z;
vehicleInfo[veh][rot] = KI_ROT;
vehicleInfo[veh][color1] = rand1;
vehicleInfo[veh][color2] = rand2;
vehicleInfo[veh][model] = IdeigID[playerid];
Civilian[veh] = true;
IdeigID[playerid] = -1;
new vname[64 + 1];
format( vname, 64, \"%03d.dat\", veh );
new File: vfile = fopen(vname);
#undef LustaVagyok
#define LustaVagyok(%0) vehicleInfo[veh][%0]
if( vfile ) {
new vstring[128 + 1];
format( vstring, 128, \"%f,%f,%f,%f,%d,%d,%d,%s\", LustaVagyok(xpos), LustaVagyok(ypos), LustaVagyok(zpos), LustaVagyok(rot), LustaVagyok(color1), LustaVagyok(color2), LustaVagyok(model), LustaVagyok(plate) );
fwrite( vfile, vstring );
fclose( vfile );
}
SendClientMessage( playerid, 0x4a7affAA, \"INFO: {ffffff}Sikeresen megvetted a jármûvet.\" );
}
}
return 0;
}
public OnPlayerCommandText( playerid, cmdtext[] ) {
if( strcmp(cmdtext, \"/stats\") == 0 ) {
new str[128 + 1];
format( str, sizeof(str), \"Kocsi ID-d: %d\", playerInfo[playerid][vehileid] );
return SendClientMessage( playerid, -1, str );
}
return 1;
}
// =================================================================
stock LoadVehiclesFromFile( ) {
new string[256 + 1];
new dest[8][64 + 1];
for( new veh = 0; veh < MAX_VEHICLES; veh++ ) {
new vname[64 + 1];
format( vname, 64, \"%03d.dat\", veh );
if( fexist(vname) ) {
new File: vfile = fopen(vname, io_read);
if( vfile ) {
fread( vfile, string );
split( string, dest, \',\' );
}
new vehi = CreateVehicle( strval(dest[6]), floatstr(dest[0]), floatstr(dest[1]), floatstr(dest[2]), floatstr(dest[3]), strval(dest[4]), strval(dest[5]), 0 );
SetVehicleNumberPlate( vehi, dest[7] );
vehicleInfo[vehi][xpos] = floatstr(dest[0]);
vehicleInfo[vehi][ypos] = floatstr(dest[1]);
vehicleInfo[vehi][zpos] = floatstr(dest[2]);
vehicleInfo[vehi][rot] = floatstr(dest[3]);
vehicleInfo[vehi][color1] = strval(dest[4]);
vehicleInfo[vehi][color2] = strval(dest[5]);
vehicleInfo[vehi][model] = strval(dest[6]);
format( vehicleInfo[vehi][plate], 32, \"%s\", dest[7] );
printf( \"%d ID jármû betöltve.\", vehi );
}
}
return 1;
}
stock split( const strsrc[], strdest[][], delimiter ) {
new i, li;
new aNum;
new len;
while(i <= strlen(strsrc)){
if(strsrc==delimiter || i==strlen(strsrc)){
len = strmid(strdest[aNum], strsrc, li, i, 128);
strdest[aNum][len] = 0;
li = i+1;
aNum++;
}
i++;
}
return 1;
}
new VehicleNames[212][] = {
{\"Landstalker\"},{\"Bravura\"},{\"Buffalo\"},{\"Linerunner\"},{\"Perennial\"},{\"Sentinel\"},{\"Dumper\"}, {\"Firetruck\"},{\"Trashmaster\"},{\"Stretch\"},{\"Manana\"},{\"Infernus\"},{\"Voodoo\"},{\"Pony\"},{\"Mule\"}, {\"Cheetah\"},{\"Ambulance\"},{\"Leviathan\"},{\"Moonbeam\"},{\"Esperanto\"},{\"Taxi\"},{\"Washington\"}, {\"Bobcat\"},{\"Mr Whoopee\"},{\"BF Injection\"},{\"Hunter\"},{\"Premier\"},{\"Enforcer\"},{\"Securicar\"},
{\"Banshee\"},{\"Predator\"},{\"Bus\"},{\"Rhino\"},{\"Barracks\"},{\"Hotknife\"},{\"Trailer 1\"},{\"Previon\"}, {\"Coach\"},{\"Cabbie\"},{\"Stallion\"},{\"Rumpo\"},{\"RC Bandit\"},{\"Romero\"},{\"Packer\"},{\"Monster\"}, {\"Admiral\"},{\"Squalo\"},{\"Seasparrow\"},{\"Pizzaboy\"},{\"Tram\"},{\"Trailer 2\"},{\"Turismo\"}, {\"Speeder\"},{\"Reefer\"},{\"Tropic\"},{\"Flatbed\"},{\"Yankee\"},{\"Caddy\"},{\"Solair\"},{\"Berkley\'s RC Van\"},
{\"Skimmer\"},{\"PCJ-600\"},{\"Faggio\"},{\"Freeway\"},{\"RC Baron\"},{\"RC Raider\"},{\"Glendale\"},{\"Oceanic\"}, {\"Sanchez\"},{\"Sparrow\"},{\"Patriot\"},{\"Quad\"},{\"Coastguard\"},{\"Dinghy\"},{\"Hermes\"},{\"Sabre\"}, {\"Rustler\"},{\"ZR-350\"},{\"Walton\"},{\"Regina\"},{\"Comet\"},{\"BMX\"},{\"Burrito\"},{\"Camper\"},{\"Marquis\"}, {\"Baggage\"},{\"Dozer\"},{\"Maverick\"},{\"News Chopper\"},{\"Rancher\"},{\"FBI Rancher\"},{\"Virgo\"},{\"Greenwood\"},
{\"Jetmax\"},{\"Hotring\"},{\"Sandking\"},{\"Blista Compact\"},{\"Police Maverick\"},{\"Boxville\"},{\"Benson\"}, {\"Mesa\"},{\"RC Goblin\"},{\"Hotring Racer A\"},{\"Hotring Racer B\"},{\"Bloodring Banger\"},{\"Rancher\"}, {\"Super GT\"},{\"Elegant\"},{\"Journey\"},{\"Bike\"},{\"Mountain Bike\"},{\"Beagle\"},{\"Cropdust\"},{\"Stunt\"},
{\"Tanker\"}, {\"Roadtrain\"},{\"Nebula\"},{\"Majestic\"},{\"Buccaneer\"},{\"Shamal\"},{\"Hydra\"},{\"FCR-900\"}, {\"NRG-500\"},{\"HPV1000\"},{\"Cement Truck\"},{\"Tow Truck\"},{\"Fortune\"},{\"Cadrona\"},{\"FBI Truck\"}, {\"Willard\"},{\"Forklift\"},{\"Tractor\"},{\"Combine\"},{\"Feltzer\"},{\"Remington\"},{\"Slamvan\"},
{\"Blade\"},{\"Freight\"},{\"Streak\"},{\"Vortex\"},{\"Vincent\"},{\"Bullet\"},{\"Clover\"},{\"Sadler\"}, {\"Firetruck LA\"},{\"Hustler\"},{\"Intruder\"},{\"Primo\"},{\"Cargobob\"},{\"Tampa\"},{\"Sunrise\"},{\"Merit\"}, {\"Utility\"},{\"Nevada\"},{\"Yosemite\"},{\"Windsor\"},{\"Monster A\"},{\"Monster B\"},{\"Uranus\"},{\"Jester\"},
{\"Sultan\"},{\"Stratum\"},{\"Elegy\"},{\"Raindance\"},{\"RC Tiger\"},{\"Flash\"},{\"Tahoma\"},{\"Savanna\"}, {\"Bandito\"},{\"Freight Flat\"},{\"Streak Carriage\"},{\"Kart\"},{\"Mower\"},{\"Duneride\"},{\"Sweeper\"}, {\"Broadway\"},{\"Tornado\"},{\"AT-400\"},{\"DFT-30\"},{\"Huntley\"},{\"Stafford\"},{\"BF-400\"},{\"Newsvan\"}, {\"Tug\"},{\"Trailer 3\"},{\"Emperor\"},{\"Wayfarer\"},{\"Euros\"},{\"Hotdog\"},{\"Club\"},{\"Freight Carriage\"},
{\"Trailer 3\"},{\"Andromada\"},{\"Dodo\"},{\"RC Cam\"},{\"Launch\"},{\"Police Car (LSPD)\"},{\"Police Car (SFPD)\"}, {\"Police Car (LVPD)\"},{\"Police Ranger\"},{\"Picador\"},{\"S.W.A.T. Van\"},{\"Alpha\"},{\"Phoenix\"},{\"Glendale\"}, {\"Sadler\"},{\"Luggage Trailer A\"},{\"Luggage Trailer B\"},{\"Stair Trailer\"},{\"Boxville\"},{\"Farm Plow\"}, {\"Utility Trailer\"}
};
stock GetVehicleIDFromName( vehiclename[], type = 0 ) {
new integer = INVALID_VEHICLE_ID;
new talalat;
if( type == 0 ) {
for( new i = 0; i < 212; i++ ) {
if( strfind(VehicleNames[0], vehiclename, true ) != -1 ) {
integer = i + 400;
talalat++;
}
}
}
else {
for( new i = 0; i < 212; i++ ) {
if( strcmp(VehicleNames[0], vehiclename, true ) == 0 ) {
integer = i + 400;
talalat++;
}
}
}
if( talalat > 1 ) {
printf( \" HIBA: Több találat a következõre: \'%s\'\", vehiclename );
return INVALID_VEHICLE_ID;
}
if( talalat == 0 ) {
printf( \" HIBA: Nincs találat a következõre: \'%s\'\", vehiclename );
}
return integer;
}
stock GetVehicleModelName( modell ) {
new STRING[64 + 1];
format( STRING, 64, \"%s\", VehicleNames[modell - 400][0] );
return STRING;
}
AddPlayerClass(0,424.2530,2456.8738,16.6250,356.0009,0,0,0,0,0,0); // Kocsi vásálás ( Pickup)
AddPlayerClass(0,402.8359,2466.7412,16.5159,90.3151,0,0,0,0,0,0); // Itt adja ki a megvett kocsit..