SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 03/02/2019, 08:14 PM   #1
andrey1311
Little Clucker
 
andrey1311's Avatar
 
Join Date: Jun 2012
Posts: 40
Reputation: 0
Default CreateObject problem

Hi. So I have a problem. I'm trying to create a object on a command but when i proceed the command the object is not creating.

PHP Code:
CMD:startfw(playeridparams[])
{
    if(!
LoggedIn[playerid]) return 1;
    if(
PlayerData[playerid][pJob] == 1) return SendClientMessage(playeridCOLOR_RED"You have started the fw")

    
CreateObject(35932581.76313199.70431281.83100.00000.0000, -90.000030.0);

To mention that I'm trying to create the object in an interior and a vw.
andrey1311 is offline   Reply With Quote
Old 03/02/2019, 08:38 PM   #2
TheToretto
Gangsta
 
TheToretto's Avatar
 
Join Date: Jul 2015
Posts: 600
Reputation: 66
Default Re: CreateObject problem

It's normal. You're returning before the code, uselessly.

Use this:

Code:
CMD:startfw(playerid, params[]) 
{ 
    if(!LoggedIn[playerid]) return 1; 
    if(PlayerData[playerid][pJob] == 1) 
    {    
        SendClientMessage(playerid, COLOR_RED, "You have started the fw"); 
        CreateObject(3593, 2581.7631, 3199.7043, 1281.8310, 0.0000, 0.0000, -90.0000, 30.0);
    }
    return 1;
}
__________________






Toretto#9902

Rest in peace grandpa, 03 November 2018
TheToretto is offline   Reply With Quote
Old 03/02/2019, 08:53 PM   #3
andrey1311
Little Clucker
 
andrey1311's Avatar
 
Join Date: Jun 2012
Posts: 40
Reputation: 0
Default Re: CreateObject problem

Quote:
Originally Posted by TheToretto View Post
It's normal. You're returning before the code, uselessly.

Use this:

Code:
CMD:startfw(playerid, params[]) 
{ 
    if(!LoggedIn[playerid]) return 1; 
    if(PlayerData[playerid][pJob] == 1) 
    {    
        SendClientMessage(playerid, COLOR_RED, "You have started the fw"); 
        CreateObject(3593, 2581.7631, 3199.7043, 1281.8310, 0.0000, 0.0000, -90.0000, 30.0);
    }
    return 1;
}
Thanks. It's working.
andrey1311 is offline   Reply With Quote
Old 03/02/2019, 08:54 PM   #4
Pottus
High-roller
 
Pottus's Avatar
 
Join Date: Jun 2012
Posts: 4,854
Reputation: 1292
Default Re: CreateObject problem

Quote:
Originally Posted by TheToretto View Post
It's normal. You're returning before the code, uselessly.

Use this:

Code:
CMD:startfw(playerid, params[]) 
{ 
    if(!LoggedIn[playerid]) return 1; 
    if(PlayerData[playerid][pJob] == 1) 
    {    
        SendClientMessage(playerid, COLOR_RED, "You have started the fw"); 
        CreateObject(3593, 2581.7631, 3199.7043, 1281.8310, 0.0000, 0.0000, -90.0000, 30.0);
    }
    return 1;
}
That is what happens when you use multiple returns.

Code:
CMD:startfw(playerid, params[])
{
    if(	(LoggedIn[playerid]) &&
    	(PlayerData[playerid][pJob] == 1) )
    {
        SendClientMessage(playerid, COLOR_RED, "You have started the fw");
        CreateObject(3593, 2581.7631, 3199.7043, 1281.8310, 0.0000, 0.0000, -90.0000, 30.0);
    }
    return 1;
}
Pottus is offline   Reply With Quote
Old 03/02/2019, 09:09 PM   #5
andrey1311
Little Clucker
 
andrey1311's Avatar
 
Join Date: Jun 2012
Posts: 40
Reputation: 0
Default Re: CreateObject problem

Quote:
Originally Posted by Pottus View Post
That is what happens when you use multiple returns.

Code:
CMD:startfw(playerid, params[])
{
    if(	(LoggedIn[playerid]) &&
    	(PlayerData[playerid][pJob] == 1) )
    {
        SendClientMessage(playerid, COLOR_RED, "You have started the fw");
        CreateObject(3593, 2581.7631, 3199.7043, 1281.8310, 0.0000, 0.0000, -90.0000, 30.0);
    }
    return 1;
}
thank you so much.
andrey1311 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
Problem regarding CreateObject Somalez Scripting Help 4 12/11/2014 01:24 PM
CreateObject problem Aleksabre Scripting Help 4 13/09/2013 12:49 PM
CreateObject problem. Vegas. Scripting Help 4 19/11/2012 09:38 AM
CreateObject Problem Blackazur Scripting Help 0 31/10/2012 08:56 PM
Problem with CreateObject rangerxxll Scripting Help 4 21/02/2012 10:15 PM


All times are GMT. The time now is 05:58 AM.


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