Actors not spawning?
#1

Maintaining tradition I'm willing to bet this is going to be something stupid from my part, but I have an issue where actors seem to not be spawning.

Here is the code.

Code:
public OnGameModeInit()
{

 EnableStuntBonusForAll(0);
 ShowPlayerMarkers(0);
 ManualVehicleEngineAndLights();
 SetGameModeText("Crime Life RPG");
 
 new ActorOGF;
 new ActorLSB;
 new ActorLSV;
 
 ActorOGF = CreateActor(28, 2438.7710,-1901.5355,13.5534,322.5977); //Actor OGF
 ApplyActorAnimation(ActorOGF, "DEALER", "DEALER_IDLE", 4.1, 1, 0, 0, 0, 0);
 ActorLSV = CreateActor(30, 2700.7739,-1106.5424,69.5781,139.4486); // Actor LSV
 ApplyActorAnimation(ActorLSV, "DEALER", "DEALER_IDLE", 4.1, 1, 0, 0, 0, 0);
 ActorLSB = CreateActor(183, 1974.7064,-1306.3206,20.8374,268.4688); //Actor LSB
 ApplyActorAnimation(ActorLSB, "DEALER", "DEALER_IDLE", 4.1, 1, 0, 0, 0, 0);

 //OGF Skins
 AddPlayerClass(105,2512.4141,-1672.3031,13.4929,88.7945,0,0,0,0,0,0);
 AddPlayerClass(106,2512.4141,-1672.3031,13.4929,88.7945,0,0,0,0,0,0);
 AddPlayerClass(107,2512.4141,-1672.3031,13.4929,88.7945,0,0,0,0,0,0);

 //Balla Skins
 AddPlayerClass(102,2172.0588,-1677.4969,15.0859,317.7590,0,0,0,0,0,0);
 AddPlayerClass(103,2172.0588,-1677.4969,15.0859,317.7590,0,0,0,0,0,0);
 AddPlayerClass(104,2172.0588,-1677.4969,15.0859,317.7590,0,0,0,0,0,0);

 //Vago Skins
 AddPlayerClass(108,2704.3115,-1276.2922,57.8825,314.3106,0,0,0,0,0,0);
 AddPlayerClass(109,2704.3115,-1276.2922,57.8825,314.3106,0,0,0,0,0,0);
 AddPlayerClass(110,2704.3115,-1276.2922,57.8825,314.3106,0,0,0,0,0,0);

 //Civilian Skins
 AddPlayerClass(47,2230.6743,-1177.9518,25.7266,43.1502,0,0,0,0,0,0);
 AddPlayerClass(48,2230.6743,-1177.9518,25.7266,43.1502,0,0,0,0,0,0);
 AddPlayerClass(46,2230.6743,-1177.9518,25.7266,43.1502,0,0,0,0,0,0);
 AddPlayerClass(28,2230.6743,-1177.9518,25.7266,43.1502,0,0,0,0,0,0);
 AddPlayerClass(25,2230.6743,-1177.9518,25.7266,43.1502,0,0,0,0,0,0);
 AddPlayerClass(21,2230.6743,-1177.9518,25.7266,43.1502,0,0,0,0,0,0);
 AddPlayerClass(23,2230.6743,-1177.9518,25.7266,43.1502,0,0,0,0,0,0);
 AddPlayerClass(29,2230.6743,-1177.9518,25.7266,43.1502,0,0,0,0,0,0);
 AddPlayerClass(101,2230.6743,-1177.9518,25.7266,43.1502,0,0,0,0,0,0);

 //Police & Cadet Skins
 AddPlayerClass(71,1544.9873,-1680.7393,13.5595,56.2242,0,0,0,0,0,0);
 AddPlayerClass(280,1544.9873,-1680.7393,13.5595,56.2242,0,0,0,0,0,0);
 AddPlayerClass(281,1544.9873,-1680.7393,13.5595,56.2242,0,0,0,0,0,0);
 AddPlayerClass(284,1544.9873,-1680.7393,13.5595,56.2242,0,0,0,0,0,0);
 
 return 1;
}
Reply
#2

I am not sure why the problem occurs, but is there any errors or warning during the compiling of the script?
Reply
#3

No errors or warning when compiling.
Reply
#4

Are you sure you are in the same virtual world as the actor? Try creating a debug getting the actor's virtual world and your virtual world...

Here's an example:

PHP Code:
public OnGameModeInit()
{
     
ActorOGF CreateActor(282438.7710,-1901.5355,13.5534,322.5977); //Actor OGF
     
ApplyActorAnimation(ActorOGF"DEALER""DEALER_IDLE"4.110000);
     
printf("Actor's virtual world: %d"GetActorVirtualWorld(ActorOGF); // This will get the actor's virtual world.
     
return 1;
}
CMD:myvw(playeridparams[])
{
    new 
str[20];
    
format(strsizeof(str), "Your virtual world is: %d"GetPlayerVirtualWorld(playerid)); // This will get your virtual world
    
SendClientMessage(playerid, -1str);
    return 
1;

Reply
#5

Quote:
Originally Posted by willbedie
View Post
Are you sure you are in the same virtual world as the actor? Try creating a debug getting the actor's virtual world and your virtual world...

Here's an example:

PHP Code:
public OnGameModeInit()
{
     
ActorOGF CreateActor(282438.7710,-1901.5355,13.5534,322.5977); //Actor OGF
     
ApplyActorAnimation(ActorOGF"DEALER""DEALER_IDLE"4.110000);
     
printf("Actor's virtual world: %d"GetActorVirtualWorld(ActorOGF); // This will get the actor's virtual world.
     
return 1;
}
CMD:myvw(playeridparams[])
{
    new 
str[20];
    
format(strsizeof(str), "Your virtual world is: %d"GetPlayerVirtualWorld(playerid)); // This will get your virtual world
    
SendClientMessage(playerid, -1str);
    return 
1;

Yep, you should try that, also make sure you also check the actor interior, but i think it will be fine since it set to 0 default, unless you're spawning an actor inside a building, you need to set it's interior ID.
Reply
#6

Console says the Actor's virtual world is 0, and when I use the myvw command it doesn't return a value, it only says "Your virtual world is ".

I am not spawning the actor in an interior.

I find it weird that it does not return a value for my VW. I even attempted setting my VW OnPlayerSpawn, it still did not return a value.
Reply
#7

If the debugger does not show you your current virtual world, then it is possible that you have some problem with the judador's world, maybe you established a virtual world that is not valid or unrecognizable. Make sure you do not have any function in your code that affects the player's world.

EDIT: You used SetActorVirtualWorld?
Reply
#8

I've gone through all my filterscripts and my gamemode and there are no occurences of the word "World" anywhere but the debug.
Reply
#9

PHP Code:
public OnPlayerSpawn(playerid
{
    new 
vw GetPlayerVirtualWorld(playerid);
    
SendClientMessage(playerid, -1vw);
    return 
1;

This should send you what's your virtual world when you spawn.
Not tested.
Reply
#10

Quote:
Originally Posted by Salint
View Post
PHP Code:
public OnPlayerSpawn(playerid
{
    new 
vw GetPlayerVirtualWorld(playerid);
    
SendClientMessage(playerid, -1vw);
    return 
1;

This should send you what's your virtual world when you spawn.
Not tested.
I tweaked this with:

Code:
public OnPlayerSpawn(playerid)
{
	new str[128];
    new vw = GetPlayerVirtualWorld(playerid);
    format(str, sizeof(str),"Virtual world is %d", vw);
    SendClientMessage(playerid, -1, str);
    return 1;
}
and it returned:

"Virtual world is 0"

I'm getting really confused as to why actors are not spawning..
Reply


Forum Jump:


Users browsing this thread: 6 Guest(s)