SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 10/09/2018, 06:37 PM   #1
B-rian
Little Clucker
 
Join Date: Nov 2010
Posts: 46
Reputation: 0
Default Actors not spawning?

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;
}
B-rian is offline   Reply With Quote
Old 10/09/2018, 07:14 PM   #2
Salint
Little Clucker
 
Salint's Avatar
 
Join Date: Aug 2018
Posts: 6
Reputation: 0
Default Re: Actors not spawning?

I am not sure why the problem occurs, but is there any errors or warning during the compiling of the script?
Salint is offline   Reply With Quote
Old 10/09/2018, 07:32 PM   #3
B-rian
Little Clucker
 
Join Date: Nov 2010
Posts: 46
Reputation: 0
Default Re: Actors not spawning?

No errors or warning when compiling.
B-rian is offline   Reply With Quote
Old 10/09/2018, 08:24 PM   #4
solstice_
Gangsta
 
solstice_'s Avatar
 
Join Date: Feb 2016
Location: basement
Posts: 540
Reputation: 68
Default Re: Actors not spawning?

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;

solstice_ is offline   Reply With Quote
Old 10/09/2018, 08:44 PM   #5
Salint
Little Clucker
 
Salint's Avatar
 
Join Date: Aug 2018
Posts: 6
Reputation: 0
Default Re: Actors not spawning?

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.
Salint is offline   Reply With Quote
Old 10/09/2018, 09:03 PM   #6
B-rian
Little Clucker
 
Join Date: Nov 2010
Posts: 46
Reputation: 0
Default Re: Actors not spawning?

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.
B-rian is offline   Reply With Quote
Old 10/09/2018, 09:16 PM   #7
Undef1ned
Huge Clucker
 
Undef1ned's Avatar
 
Join Date: Aug 2018
Posts: 211
Reputation: 18
Default Re: Actors not spawning?

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?
Undef1ned is offline   Reply With Quote
Old 10/09/2018, 09:19 PM   #8
B-rian
Little Clucker
 
Join Date: Nov 2010
Posts: 46
Reputation: 0
Default Re: Actors not spawning?

I've gone through all my filterscripts and my gamemode and there are no occurences of the word "World" anywhere but the debug.
B-rian is offline   Reply With Quote
Old 10/09/2018, 09:25 PM   #9
Salint
Little Clucker
 
Salint's Avatar
 
Join Date: Aug 2018
Posts: 6
Reputation: 0
Default Re: Actors not spawning?

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.
Salint is offline   Reply With Quote
Old 10/09/2018, 09:26 PM   #10
Undef1ned
Huge Clucker
 
Undef1ned's Avatar
 
Join Date: Aug 2018
Posts: 211
Reputation: 18
Default Re: Actors not spawning?

I mean SetPlayerVirtualWorld, in "OnPlayerConnect or OnPlayerSpawn"

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.
And what do you mean by that, you think that is at least well done. Do not try to publish random answers without knowing at least one coherent solution.

EDIT: I just realized that the code that @willbedie gave you, has a small string for a text much more lake. debug with this:

PHP Code:
CMD:myvw(playeridparams[]) 

    new 
str[30]; 
    
format(str30"Your virtual world is: %d"GetPlayerVirtualWorld(playerid));
    
SendClientMessage(playerid, -1str); 
    return 
1

Undef1ned is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Tutorial] Actors!(0.3.7 RC6) Abagail Tutorials 31 25/06/2018 08:33 PM
About actors Eyce Scripting Help 3 18/04/2016 02:51 PM
Actors scripting spawning problem DavidMcRazy Scripting Help 9 02/12/2015 04:33 PM
[Help] Actors Andy5 Scripting Help 4 06/08/2015 10:55 PM
Actors ATomas Scripting Help 17 30/04/2015 05:55 PM


All times are GMT. The time now is 12:36 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.