SA-MP Forums Archive
Help in Creating Dealerships. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Help in Creating Dealerships. (/showthread.php?tid=554611)



Help in Creating Dealerships. - HY - 04.01.2015

Hello, so I want to create an ownership system on my server...
And I started, but I need to store cars in a dealerships. So I started creating dealerships dynamics.

pawn Код:
CMD:createdealership(playerid, params[])
{
    new Float:X, Float:Y, Float:Z, string[128], labelstring[128], pick, name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
    GetPlayerPos(playerid, X, Y, Z);
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "{FF0000}ERROR: {FFFFFF}You are not authorized to use this command.");
    if(isnull(params)) return SendClientMessage(playerid, -1, "{FF0000}USAGE: {FFFFFF}/CreateDealership [Dealership name]");
    if(!strlen(params)) return SendClientMessage(playerid, -1, "{FF0000}ERROR: {FFFFFF}Invalid name.");
    if(strval(params) > 50) return SendClientMessage(playerid, -1, "{FF0000}ERROR: {FFFFFF}Invalid characters. [1-50]");
    pick = CreatePickup(1239, 1, X, Y, Z, -1);
    format(labelstring, sizeof(labelstring), "{FFFFFF}Dealership ID: {FF0000}%d\n{FFFFFF}Dealership Name: {FF0000}%s\n", dealerid,  params);
    format(string, sizeof(string), "{FF0000}[INFO]: {FFFFFF}Dealership ID: {FF0000}%d {FFFFFF}with name: {FF0000}%s {FFFFFF}was created.", dealerid, params);
    SendClientMessage(playerid, -1, string);
    printf("Administrator %s has created Dealership ID: %d with name: %s", name, dealerid, params);
    Dealerships[dealerid][dName] = strval(params);
    Dealerships[dealerid][dPickup] = pick;
    Dealerships[dealerid][dLabel] = Create3DTextLabel(labelstring, 0xFFFFFFFF, X, Y, Z, 100, -1);
    Dealerships[dealerid][dX] = X;
    Dealerships[dealerid][dY] = Y;
    Dealerships[dealerid][dZ] = Z;
    new INI:File = INI_Open(DealerPath());
    INI_SetTag(File, "Dealerships");
    INI_WriteString(File, "Dealership name", params);
    INI_WriteInt(File, "Dealership ID", dealerid);
    INI_WriteString(File,"Label text", labelstring);
    INI_WriteInt(File, "Pickup ID", 1239);
    INI_WriteInt(File, "Pickup World", -1);
    INI_WriteInt(File, "Pickup Type", 1);
    INI_Close(File);
    dealerid++;
    return 1;
}
No errors, but when I made command works fine in folder, but In-Game doesn't show label. Only 1 second, then disappear. What's problem?

pawn Код:
Dealerships[dealerid][dLabel] = Create3DTextLabel(labelstring, 0xFFFFFFFF, X, Y, Z, 100, -1);
Thanks.
+ Rep for helper.


Re: Help in Creating Dealerships. - HY - 04.01.2015

Nobody? :>