Why wont this work?
#1

pawn Код:
CMD:setfactionent(playerid, params[])
{
    if(LoggedIn[playerid] == 0) return SendClientMessage(playerid, COLOUR_GREY, "You must be logged in to use this command.");
    if(AdminLevel[playerid] < 4) return SendClientMessage(playerid, COLOUR_GREY, "You are not authorized to use this command.");
    if(isnull(params)) return SendClientMessage(playerid, COLOUR_GREY, "Usage: /setfactionent [factionid]");
    new factionid = strval(params);
    new id = MySQL_GetValue(FactionSQLID[id], "id", "factions");
   
    new Float: x, Float: y, Float: z;
    GetPlayerPos(playerid, x, y, z);
   
    FactionEntX[factionid] = x;
    FactionEntY[factionid] = y;
    FactionEntZ[factionid] = z;
    CreateDynamicPickup(1318, 23, FactionEntX[factionid], FactionEntY[factionid], FactionEntZ[factionid], 0, -1, -1, 100);

    MySQL_SetFloat(FactionSQLID[factionid], "FactionEntX", x, "factions");
    MySQL_SetFloat(FactionSQLID[factionid], "FactionEntY", y, "factions");
    MySQL_SetFloat(FactionSQLID[factionid], "FactionEntZ", z, "factions");
    new string[128];
    format(string, sizeof(string), "You have set %s's entrance", FactionName[factionid]);
    SendClientMessage(playerid, COLOUR_LIGHTBLUE, string);
    return 1;
}
I cannot think of a single reason as to why this wont work and yes, the MySQL_SetFloat Works.

Thanks in advance.
Reply
#2

Explain "Won't work".
Reply
#3

Your missing a scanf aren't you?
Код:
if(sscanf(params, "u", id))
    {
        SendClientMessage(playerid, 0xFF0000FF, "Usage: /setfactionent [factionid]");
        return 1;
    }
Reply
#4

Quote:
Originally Posted by brett7
Посмотреть сообщение
Your missing a scanf aren't you?
Код:
if(sscanf(params, "u", id))
    {
        SendClientMessage(playerid, 0xFF0000FF, "Usage: /setfactionent [factionid]");
        return 1;
    }
He didn't use sscanf.
pawn Код:
if(isnull(params)) return SendClientMessage(playerid, COLOUR_GREY, "Usage: /setfactionent [factionid]");
    new factionid = strval(params);
Reply
#5

AS in, the command In-game will not work, it returns the function success = 0 as in, it says Command not recognized.
Reply
#6

Show me MYSQL_SetFloat.
Reply
#7

pawn Код:
MySQL_SetFloat(sqlid, fieldname[], Float:value, tablename[])
{
    new query[256];
    format(query, sizeof(query), "UPDATE %s SET %s = %f WHERE id = %d LIMIT 1", tablename, fieldname, value, sqlid);
    return mysql_query(query);
}
There ya go.
Reply
#8

Any issue there?
Reply
#9

1st of all use sscanf.
If you want, I'll re-write this code using sscanf.

2nd of all don't you use a variable to create the pickup?

pawn Код:
CMD:setfactionent(playerid, params[])
{
    if(LoggedIn[playerid] == 0) return SendClientMessage(playerid, COLOUR_GREY, "You must be logged in to use this command.");
    if(AdminLevel[playerid] < 4) return SendClientMessage(playerid, COLOUR_GREY, "You are not authorized to use this command.");
    if(isnull(params)) return SendClientMessage(playerid, COLOUR_GREY, "Usage: /setfactionent [factionid]");
    new factionid = strval(params);
    new id = MySQL_GetValue(FactionSQLID[id], "id", "factions");
   
    new Float: x, Float: y, Float: z;
    GetPlayerPos(playerid, x, y, z);
   
    FactionEntX[factionid] = x;
    FactionEntY[factionid] = y;
    FactionEntZ[factionid] = z;
    YOURVARHERE = CreateDynamicPickup(1318, 23, FactionEntX[factionid], FactionEntY[factionid], FactionEntZ[factionid], 0, -1, -1, 100);

    MySQL_SetFloat(FactionSQLID[factionid], "FactionEntX", x, "factions");
    MySQL_SetFloat(FactionSQLID[factionid], "FactionEntY", y, "factions");
    MySQL_SetFloat(FactionSQLID[factionid], "FactionEntZ", z, "factions");
    new string[128];
    format(string, sizeof(string), "You have set %s's entrance", FactionName[factionid]);
    SendClientMessage(playerid, COLOUR_LIGHTBLUE, string);
    return 1;
}
Reply
#10

I've used sscanf before, it didnt really make a difference, I'll try again and yeah there is a variable FactionPickup, but I dont see how thats relevant?

Thank you very much, i'll let you know if this works.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)