SA-MP Forums Archive
Something wrong? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Something wrong? (/showthread.php?tid=619848)



Something wrong? - NealPeteros - 23.10.2016

Is there something wrong here?
PHP код:
SetSpawnInfo(playerid0ZOMBIE_SKINZombieSpawns[spawn][0], ZombieSpawns[spawn][1], ZombieSpawns[spawn][2], 000000); 
It says that the number of arguments doesn't match definition. Here's the SetSpawnInfo wiki link [click me]


Re: Something wrong? - DTV - 23.10.2016

You forgot the angle in which the player will spawn, after the z coord.


Re: Something wrong? - NealPeteros - 23.10.2016

It's in. I forgot to send my full code. Here it is. It's a FS. [click me]


Re: Something wrong? - DTV - 23.10.2016

If you count, you only filled in 12 of the 13 arguments. If you added 0.0 after the z coord, it will be fixed.


Re: Something wrong? - NealPeteros - 23.10.2016

So, the warning is fixed. Only problem is that the NPC won't spawn. Here's the new paste [click me]


Re: Something wrong? - DTV - 23.10.2016

I've never worked much with NPCs and how they worked, but I'm pretty sure it doesn't spawn because you're trying to spawn the NPC under OnPlayerSpawn. That callback is called only when a player/npc is spawned, so there will be no effect under OnPlayerSpawn. You'll have to set the zombie's pos and spawn them in a different callback.


Re: Something wrong? - NealPeteros - 23.10.2016

So, what do you suggest me to do?


Re: Something wrong? - DTV - 23.10.2016

Have the NPCs spawn under OnPlayerConnect.


Re: Something wrong? - NealPeteros - 23.10.2016

Something like this?
PHP код:
public OnPlayerConnect(playerid)
{
    
ApplyAnimation(playerid"BOMBER""null"000001);
    
ApplyAnimation(playerid"PED""null"000001);
    if(
IsPlayerNPC(playerid))
    {
        new 
spawn random(sizeof(ZombieSpawns));
        
SetSpawnInfo(playerid0ZOMBIE_SKINZombieSpawns[spawn][0], ZombieSpawns[spawn][1], ZombieSpawns[spawn][2], 0.0000000);
        
SpawnPlayer(playerid);
        
SetRNPCHealth(playeridZOMBIE_HEALTH);
        
SetPlayerColor(playeridZOMBIE_COLOR);
        
RNPC_SetShootable(playerid1);
        
RNPC_ToggleVehicleCollisionCheck(playerid1);
        
GetZombieVictimID[playerid] = INVALID_PLAYER_ID;
        return 
1;
    }
    else
    {
        
GetVictimDetectRange[playerid] = ZOMBIE_DETECT;
        
GetVictimTimerStatus[playerid] = 0;
    }
    return 
1;
}
public 
OnPlayerSpawn(playerid)
{
    return 
1;




Re: Something wrong? - DTV - 23.10.2016

pawn Код:
if(IsPlayerNPC(playerid))
    {
        new spawn = random(sizeof(ZombieSpawns));
        SetSpawnInfo(playerid, 0, ZOMBIE_SKIN, ZombieSpawns[spawn][0], ZombieSpawns[spawn][1], ZombieSpawns[spawn][2], 0.0, 0, 0, 0, 0, 0, 0);
        SpawnPlayer(playerid);

        SetRNPCHealth(playerid, ZOMBIE_HEALTH);
        SetPlayerColor(playerid, ZOMBIE_COLOR);

        RNPC_SetShootable(playerid, 1);
        RNPC_ToggleVehicleCollisionCheck(playerid, 1);

        GetZombieVictimID[playerid] = INVALID_PLAYER_ID;
        return 1;
    }
    else
    {
        GetVictimDetectRange[playerid] = ZOMBIE_DETECT;
        GetVictimTimerStatus[playerid] = 0;
    }
I think this is all that needs to be put in there, the animations won't matter as far as I know if they're in OnPlayerConnect.