CreateObject problem
#1

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 код:
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.
Reply
#2

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

Use this:

Код:
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;
}
Reply
#3

Quote:
Originally Posted by TheToretto
Посмотреть сообщение
It's normal. You're returning before the code, uselessly.

Use this:

Код:
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.
Reply
#4

Quote:
Originally Posted by TheToretto
Посмотреть сообщение
It's normal. You're returning before the code, uselessly.

Use this:

Код:
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.

Код:
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;
}
Reply
#5

Quote:
Originally Posted by Pottus
Посмотреть сообщение
That is what happens when you use multiple returns.

Код:
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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)