PhantomDamn Posted September 13, 2013 Posted September 13, 2013 Hola comunidad... tengo un problema con un script de car spawn.. lo que pasa es que si creo un auto y me voy del marker llega otro player y spawnea mi auto .. osea que me lo quitan... este es el script... quiero que cree varios vehiculos para que no se le desaparesca a nadie local marker = createMarker(1573.3645019531, -1878.6141357422 , 12.2, "cylinder", 1.5, 255 ,255, 255, 155) function vehicle(thePlayer) if getElementType(thePlayer) == "player" then if isPedInVehicle(thePlayer)==true then return end if isElement( veh ) then destroyElement( veh ) end local x,y,z = getElementPosition(thePlayer) veh = createVehicle(411, x,y,z) warpPedIntoVehicle(thePlayer, veh) end end addEventHandler("onMarkerHit", marker, vehicle) solo pense en usar esto pero no se como acomodarlo setElementModel(source, 411) createVehicle(x, y, z ) |El Sabio no tiene intereses propios, hace suyos los intereses del pueblo| (scripting= -20%)
Castillo Posted September 13, 2013 Posted September 13, 2013 El problema es que estas usando la misma variable para todos los jugadores, tenes que usar una tabla. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
PhantomDamn Posted September 13, 2013 Author Posted September 13, 2013 explicame, o dime que funcion puedo usar para ver en la wiki warpPedIntoVehicle ( ped thePed, vehicle theVehicle ) ?? |El Sabio no tiene intereses propios, hace suyos los intereses del pueblo| (scripting= -20%)
Castillo Posted September 13, 2013 Posted September 13, 2013 Creas una tabla, y ahi metes todos los vehiculos usando el jugador como index. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
PhantomDamn Posted September 13, 2013 Author Posted September 13, 2013 mira solid, no quiero sino solo el infernus, ya se a que te refieres con tabla ocal VehicleTable = { 602, 545, 496, 517, 401, 410, 518, 600, 527, 436, 589, 580, 419, 439, 533, 549, 526, 491, 474, 445, 467, 604, 426, 507, 547, 585, 405, 587, 409, 466, 550, 492, 566, 546, 540, 551, 421, 516, 529, 592, 553, 577, 488, 511, 497, 548, 563, 512, 476, 593, 447, 425, 519, 520, 460, 417, 469, 487, 513, 581, 510, 509, 522, 481, 461, 462, 448, 521, 468, 463, 586, 472, 473, 493, 595, 484, 430, 453, 452, 446, 454, 485, 552, 431, 438, 437, 574, 420, 525, 408, 416, 596, 433, 597, 427, 599, 490, 432, 528, 601, 407, 428, 544, 523, 470, 598, 499, 588, 609, 403, 498, 514, 524, 423, 532, 414, 578, 443, 486, 515, 406, 531, 573, 456, 455, 459, 543, 422, 583, 482, 478, 605, 554, 530, 418, 572, 582, 413, 440, 536, 575, 534, 567, 535, 576, 412, 402, 542, 603, 475, 449, 537, 538, 441, 464, 501, 465, 564, 568, 557, 424, 471, 504, 495, 457, 539, 483, 508, 571, 500, 444, 556, 429, 411, 541, 559, 415, 561, 480, 560, 562, 506, 565, 451, 434, 558, 494, 555, 502, 477, 503, 579, 400, 404, 489, 505, 479, 442, 458, 606, 607, 610, 590, 569, 611, 584, 608, 435, 450, 591, 594 } pero lo que quiero es que sea una sola id... "411" pero que se puedan sacar varios sin que se elimine el primero.. mirare eso de index |El Sabio no tiene intereses propios, hace suyos los intereses del pueblo| (scripting= -20%)
Sasu Posted September 13, 2013 Posted September 13, 2013 (edited) local marker = createMarker(1573.3645019531, -1878.6141357422 , 12.2, "cylinder", 1.5, 255 ,255, 255, 155) local veh = {} function vehicle(thePlayer) if getElementType(thePlayer) == "player" then if isPedInVehicle(thePlayer) then return end if isElement( veh[thePlayer] ) then destroyElement( veh[thePlayer] ) end local x,y,z = getElementPosition(thePlayer) veh[thePlayer] = createVehicle(411, x,y,z) warpPedIntoVehicle(thePlayer, veh[thePlayer]) end end addEventHandler("onMarkerHit", marker, vehicle) Edited September 14, 2013 by Guest State: Inactive
GamerDeMTA Posted September 13, 2013 Posted September 13, 2013 local marker = createMarker(1573.3645019531, -1878.6141357422 , 12.2, "cylinder", 1.5, 255 ,255, 255, 155) local veh = {} function vehicle(thePlayer) if getElementType(thePlayer) == "player" then if isPedInVehicle(thePlayer)==true then return end if isElement( veh[thePlayer] ) then destroyElement( veh[thePlayer] ) end local x,y,z = getElementPosition(thePlayer) veh[thePlayer] = createVehicle(411, x,y,z) warpPedIntoVehicle(thePlayer, veh[thePlayer]) end end addEventHandler("onMarkerHit", marker, vehicle) la linea 6 esta mal
PhantomDamn Posted September 14, 2013 Author Posted September 14, 2013 pero me funciono correctamente y nada en debug |El Sabio no tiene intereses propios, hace suyos los intereses del pueblo| (scripting= -20%)
Alexs Posted September 14, 2013 Posted September 14, 2013 la linea 6 esta mal No esta mal, if true then es igual a: if true == true then Pero te recomendaría mas la primera forma. Developer @ MYVAL
Recommended Posts