[Ayuda] Funcion completa.
#1

Resulta que tengo el GM base de ZC, entonces intente quitar el /llaves, pero al poner la opcion en onplayerspawn y borrar las cosas que no funcionarian.. todo bien, pero resulta que al logear un player que tiene 5 vehiculos, solo le spawneara el primer vehiculo (Slot 0), entonces necesito una funcion para que al logear todos los vehiculos spawneen no solo el primero.. aqui esta lo que tengo en onplayerspawn.

Код:
for(new listitem = 0; listitem < 8; listitem++) // 10 para 10 slots si tenes muchos coches
{
    		if(PlayerVehicleInfo[playerid][listitem][pvImpounded] == 1) return SendClientMessageEx(playerid,COLOR_WHITE,"El auto que intenta spawnear estб embargado.");
	    	if(PlayerVehicleInfo[playerid][listitem][pvImpounded] >= 2) PlayerVehicleInfo[playerid][listitem][pvImpounded] = 0;
        	if(PlayerVehicleInfo[playerid][listitem][pvModelId] != 0 && PlayerVehicleInfo[playerid][listitem][pvImpounded] == 0 && PlayerVehicleInfo[playerid][listitem][pvSpawned]== 0)
        	{
        	    if(carsforplayer[playerid] == 8) return SendClientMessageEx(playerid,COLOR_WHITE,".");
            	PlayerCars++;
            	carsforplayer[playerid]++;
				new carcreated = CreateVehicle(PlayerVehicleInfo[playerid][listitem][pvModelId], PlayerVehicleInfo[playerid][listitem][pvPosX], PlayerVehicleInfo[playerid][listitem][pvPosY], PlayerVehicleInfo[playerid][listitem][pvPosZ], PlayerVehicleInfo[playerid][listitem][pvPosAngle],PlayerVehicleInfo[playerid][listitem][pvColor1], PlayerVehicleInfo[playerid][listitem][pvColor2], -1);
				PlayerVehicleInfo[playerid][listitem][pvId] = carcreated;
				VehicleFuel[carcreated] = PlayerVehicleInfo[playerid][listitem][pvFuel];
				SetVehicleHealth(carcreated, PlayerVehicleInfo[playerid][listitem][pvHealth]);
				SetVehicleVirtualWorld(carcreated, PlayerVehicleInfo[playerid][listitem][pvVW]);
				PlayerVehicleInfo[playerid][listitem][pvSpawned] = 8;
				if(PlayerVehicleInfo[playerid][listitem][pvLocked] == 1)
				LockPlayerVehicle(playerid, PlayerVehicleInfo[playerid][listitem][pvId], PlayerVehicleInfo[playerid][listitem][pvLock]);
                LoadPlayerVehicleMods(playerid, listitem);
				return 1;
			}
    			}
Reply
#2

Te doy la soluciуn. Empeza con una base limpia y deja ese gamemode que estб mбs visto que un pбjaro al medio dнa.
Reply
#3

https://sampforum.blast.hk/showthread.php?tid=532881
Reply
#4

Estбs retornando el cуdigo al primer bucle.

pawn Код:
for(new listitem = 0; listitem < 8; listitem++) // 10 para 10 slots si tenes muchos coches
{
            if(PlayerVehicleInfo[playerid][listitem][pvImpounded] == 1) return SendClientMessageEx(playerid,COLOR_WHITE,"El auto que intenta spawnear estб embargado.");
            if(PlayerVehicleInfo[playerid][listitem][pvImpounded] >= 2) PlayerVehicleInfo[playerid][listitem][pvImpounded] = 0;
            if(PlayerVehicleInfo[playerid][listitem][pvModelId] != 0 && PlayerVehicleInfo[playerid][listitem][pvImpounded] == 0 && PlayerVehicleInfo[playerid][listitem][pvSpawned]== 0)
            {
                if(carsforplayer[playerid] == 8) return SendClientMessageEx(playerid,COLOR_WHITE,".");
                PlayerCars++;
                carsforplayer[playerid]++;
                new carcreated = CreateVehicle(PlayerVehicleInfo[playerid][listitem][pvModelId], PlayerVehicleInfo[playerid][listitem][pvPosX], PlayerVehicleInfo[playerid][listitem][pvPosY], PlayerVehicleInfo[playerid][listitem][pvPosZ], PlayerVehicleInfo[playerid][listitem][pvPosAngle],PlayerVehicleInfo[playerid][listitem][pvColor1], PlayerVehicleInfo[playerid][listitem][pvColor2], -1);
                PlayerVehicleInfo[playerid][listitem][pvId] = carcreated;
                VehicleFuel[carcreated] = PlayerVehicleInfo[playerid][listitem][pvFuel];
                SetVehicleHealth(carcreated, PlayerVehicleInfo[playerid][listitem][pvHealth]);
                SetVehicleVirtualWorld(carcreated, PlayerVehicleInfo[playerid][listitem][pvVW]);
                PlayerVehicleInfo[playerid][listitem][pvSpawned] = 8;
                if(PlayerVehicleInfo[playerid][listitem][pvLocked] == 1)
                LockPlayerVehicle(playerid, PlayerVehicleInfo[playerid][listitem][pvId], PlayerVehicleInfo[playerid][listitem][pvLock]);
                LoadPlayerVehicleMods(playerid, listitem);
                //return 1; // Este
            }
                }
Reply
#5

Borra eso que hiciste pon en onplayerdisconnect: UnloadPlayerVehicles(playerid); (si ya lo tienes dejalo asi)
En la funcion OnPlayerLogin agregale esto:
LoadPlayerVehicles(playerid);
Es todo, saludos
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)