Not working.
#1

When I do the command it is not working. Anybody help?

pawn Код:
COMMAND:loggo(playerid, params[])
{
        if(PlayerInfo[playerid][pAdmin] == 0) return SendClientMessage(playerid, COLOR_WHITE, "{F81414}[ERROR]: {FFFFFF}This command is not available in this server! Type {F81414}/help {FFFFFF}for a list of commands.");
        if(loggo[playerid] == 0)
        {
            SetPVarInt(playerid, "o1",CreateObject(19327,0,0,0,0,0,0));
            SetPVarInt(playerid, "o2",CreateObject(19327,0,0,0,0,0,0));
            SetPVarInt(playerid, "o3",CreateObject(19327,0,0,0,0,0,0));
            SetPVarInt(playerid, "o4",CreateObject(19327,0,0,0,0,0,0));
            AttachObjectToVehicle(GetPVarInt(playerid, "o1"), GetPlayerVehicleID(playerid),-1.204999, 0.000000, 0.030000, -4.020000, 0.000001, 269.340515);
            AttachObjectToVehicle(GetPVarInt(playerid, "o2"), GetPlayerVehicleID(playerid),1.204999, 0.000000, 0.030000, -4.020000, 0.000001, 449.236389);
            AttachObjectToVehicle(GetPVarInt(playerid, "o3"), GetPlayerVehicleID(playerid),-0.009999, -1.649998, 0.549999, -72.360000, 0.000000, 0.000000);
            AttachObjectToVehicle(GetPVarInt(playerid, "o4"), GetPlayerVehicleID(playerid),-0.009999, 1.584998, 0.444999, -77.384986, 0.000000, -180.900100);
            SetObjectMaterialText(GetPVarInt(playerid, "o1"), "{FFFFFF}  SERVER ADMIN{FFFFFF}", 0, OBJECT_MATERIAL_SIZE_512x64,"Arial", 50, 1, 0xFFFFFFAA, 0, OBJECT_MATERIAL_TEXT_ALIGN_CENTER);
            SetObjectMaterialText(GetPVarInt(playerid, "o2"), "{FFFFFF}SERVER ADMIN{FFFFFF}", 0, OBJECT_MATERIAL_SIZE_512x64,"Arial", 50, 1, 0xFFFFFFAA, 0, OBJECT_MATERIAL_TEXT_ALIGN_CENTER);
            SetObjectMaterialText(GetPVarInt(playerid, "o3"), "{FFFFFF}ADMIN{FFFFFF}", 0, OBJECT_MATERIAL_SIZE_256x64,"Arial", 50, 1, 0xFFFFFFAA, 0, OBJECT_MATERIAL_TEXT_ALIGN_CENTER);
            SetObjectMaterialText(GetPVarInt(playerid, "o4"), "{FFFFFF}ADMIN{FFFFFF}", 0, OBJECT_MATERIAL_SIZE_256x64,"Arial", 50, 1, 0xFFFFFFAA, 0, OBJECT_MATERIAL_TEXT_ALIGN_CENTER);
            loggo[playerid] = 1;
        }
        if(loggo[playerid] == 1)
        {
            DestroyObject(GetPVarInt(playerid, "o1"));
            DestroyObject(GetPVarInt(playerid, "o2"));
            DestroyObject(GetPVarInt(playerid, "o3"));
            DestroyObject(GetPVarInt(playerid, "o4"));
            loggo[playerid] = 0;
        }
        return 1;
}
I already did
pawn Код:
new loggo[MAX_PLAYERS];
OnPlayerConnect
pawn Код:
loggo[playerid] = 0;
Why doesn't it work?
Reply
#2

Its giving any error or warning and what message showing in game when you use this command?
Reply
#3

Let me do a brief explanation...
You connect, and loggo is 0. Then when you do the command, your loggo is at 0, so it does this:
pawn Код:
SetPVarInt(playerid, "o1",CreateObject(19327,0,0,0,0,0,0));
            SetPVarInt(playerid, "o2",CreateObject(19327,0,0,0,0,0,0));
            SetPVarInt(playerid, "o3",CreateObject(19327,0,0,0,0,0,0));
            SetPVarInt(playerid, "o4",CreateObject(19327,0,0,0,0,0,0));
            AttachObjectToVehicle(GetPVarInt(playerid, "o1"), GetPlayerVehicleID(playerid),-1.204999, 0.000000, 0.030000, -4.020000, 0.000001, 269.340515);
            AttachObjectToVehicle(GetPVarInt(playerid, "o2"), GetPlayerVehicleID(playerid),1.204999, 0.000000, 0.030000, -4.020000, 0.000001, 449.236389);
            AttachObjectToVehicle(GetPVarInt(playerid, "o3"), GetPlayerVehicleID(playerid),-0.009999, -1.649998, 0.549999, -72.360000, 0.000000, 0.000000);
            AttachObjectToVehicle(GetPVarInt(playerid, "o4"), GetPlayerVehicleID(playerid),-0.009999, 1.584998, 0.444999, -77.384986, 0.000000, -180.900100);
            SetObjectMaterialText(GetPVarInt(playerid, "o1"), "{FFFFFF}  SERVER ADMIN{FFFFFF}", 0, OBJECT_MATERIAL_SIZE_512x64,"Arial", 50, 1, 0xFFFFFFAA, 0, OBJECT_MATERIAL_TEXT_ALIGN_CENTER);
            SetObjectMaterialText(GetPVarInt(playerid, "o2"), "{FFFFFF}SERVER ADMIN{FFFFFF}", 0, OBJECT_MATERIAL_SIZE_512x64,"Arial", 50, 1, 0xFFFFFFAA, 0, OBJECT_MATERIAL_TEXT_ALIGN_CENTER);
            SetObjectMaterialText(GetPVarInt(playerid, "o3"), "{FFFFFF}ADMIN{FFFFFF}", 0, OBJECT_MATERIAL_SIZE_256x64,"Arial", 50, 1, 0xFFFFFFAA, 0, OBJECT_MATERIAL_TEXT_ALIGN_CENTER);
            SetObjectMaterialText(GetPVarInt(playerid, "o4"), "{FFFFFF}ADMIN{FFFFFF}", 0, OBJECT_MATERIAL_SIZE_256x64,"Arial", 50, 1, 0xFFFFFFAA, 0, OBJECT_MATERIAL_TEXT_ALIGN_CENTER);
            loggo[playerid] = 1;
But notice at the end of it, you are setting loggo to 1? Well, then it goes to the next 'if' statement. if(loggo[playerid] == 1). However, by the time it reaches this line, you have already set loggo to 1, so it will perform this code:
pawn Код:
DestroyObject(GetPVarInt(playerid, "o1"));
            DestroyObject(GetPVarInt(playerid, "o2"));
            DestroyObject(GetPVarInt(playerid, "o3"));
            DestroyObject(GetPVarInt(playerid, "o4"));
            loggo[playerid] = 0;
Therefore, basically undoing all the work done in the 'if(loggo[playerid] == 0)' statement. The way to fix this, is to change the 'if' statement, to an 'else if' statement.

pawn Код:
COMMAND:loggo(playerid, params[])
{
        if(PlayerInfo[playerid][pAdmin] == 0) return SendClientMessage(playerid, COLOR_WHITE, "{F81414}[ERROR]: {FFFFFF}This command is not available in this server! Type {F81414}/help {FFFFFF}for a list of commands.");
        if(loggo[playerid] == 0)
        {
            SetPVarInt(playerid, "o1",CreateObject(19327,0,0,0,0,0,0));
            SetPVarInt(playerid, "o2",CreateObject(19327,0,0,0,0,0,0));
            SetPVarInt(playerid, "o3",CreateObject(19327,0,0,0,0,0,0));
            SetPVarInt(playerid, "o4",CreateObject(19327,0,0,0,0,0,0));
            AttachObjectToVehicle(GetPVarInt(playerid, "o1"), GetPlayerVehicleID(playerid),-1.204999, 0.000000, 0.030000, -4.020000, 0.000001, 269.340515);
            AttachObjectToVehicle(GetPVarInt(playerid, "o2"), GetPlayerVehicleID(playerid),1.204999, 0.000000, 0.030000, -4.020000, 0.000001, 449.236389);
            AttachObjectToVehicle(GetPVarInt(playerid, "o3"), GetPlayerVehicleID(playerid),-0.009999, -1.649998, 0.549999, -72.360000, 0.000000, 0.000000);
            AttachObjectToVehicle(GetPVarInt(playerid, "o4"), GetPlayerVehicleID(playerid),-0.009999, 1.584998, 0.444999, -77.384986, 0.000000, -180.900100);
            SetObjectMaterialText(GetPVarInt(playerid, "o1"), "{FFFFFF}  SERVER ADMIN{FFFFFF}", 0, OBJECT_MATERIAL_SIZE_512x64,"Arial", 50, 1, 0xFFFFFFAA, 0, OBJECT_MATERIAL_TEXT_ALIGN_CENTER);
            SetObjectMaterialText(GetPVarInt(playerid, "o2"), "{FFFFFF}SERVER ADMIN{FFFFFF}", 0, OBJECT_MATERIAL_SIZE_512x64,"Arial", 50, 1, 0xFFFFFFAA, 0, OBJECT_MATERIAL_TEXT_ALIGN_CENTER);
            SetObjectMaterialText(GetPVarInt(playerid, "o3"), "{FFFFFF}ADMIN{FFFFFF}", 0, OBJECT_MATERIAL_SIZE_256x64,"Arial", 50, 1, 0xFFFFFFAA, 0, OBJECT_MATERIAL_TEXT_ALIGN_CENTER);
            SetObjectMaterialText(GetPVarInt(playerid, "o4"), "{FFFFFF}ADMIN{FFFFFF}", 0, OBJECT_MATERIAL_SIZE_256x64,"Arial", 50, 1, 0xFFFFFFAA, 0, OBJECT_MATERIAL_TEXT_ALIGN_CENTER);
            loggo[playerid] = 1;
        }
        else if(loggo[playerid] == 1)
        {
            DestroyObject(GetPVarInt(playerid, "o1"));
            DestroyObject(GetPVarInt(playerid, "o2"));
            DestroyObject(GetPVarInt(playerid, "o3"));
            DestroyObject(GetPVarInt(playerid, "o4"));
            loggo[playerid] = 0;
        }
        return 1;
}
Reply
#4

Thank you very much.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)