NEED help when am running a command!
#1

07/30/18 15:01:51 [join] Rockie has joined the server (4:41.212.151.249)
07/30/18 15:03:51 RCON (In-Game): Player #4 (Rockie) has logged in.
07/30/18 15:03:58 [debug] Run time error 10: "Native function failed"
07/30/18 15:03:58 [debug] AMX backtrace:
07/30/18 15:03:58 [debug] #0 007b9588 in public pc_cmd_screate (4, 25494680) from b9.amx

Can someone help me fixing that error? It occurs everytime When I create my stores /screate SOTRE_TYPE_BANK Name.

And now I have to enter it Manually into the SQL Can someone help me regarding this please?

Thanks,
Regards
Reply
#2

Show us the /screate command.
Reply
#3

How will I show you it lol?

Anyone help
Reply
#4

Show the command. I don't know what is the code
Reply
#5

CMDcreate(playerid, params[])
{
if(!IsPlayerAdmin(playerid) || PlayerData[playerid][e_level] != MAX_ADMIN_LEVEL)
{
return SCM(playerid, -1, NO_PERM);
}

new type;
if(sscanf(params, "is[143]", type, gstr))
{
SCM(playerid, NEF_GREEN, "STORE_TYPE_AMMUNATION, STORE_TYPE_BANK, STORE_TYPE_BURGERSHOT, STORE_TYPE_CLUCKINBELLS, STORE_TYPE_247, STORE_TYPE_STACKEDPIZZAS");
return SCM(playerid, NEF_GREEN, "Usage: /screate <type> <name>");
}

if(type < 0 || type > 6)
return SCM(playerid, -1, ""er"Invalid store type");

if(strlen(gstr) < 3 || strlen(gstr) > MAX_STORE_NAME)
return SCM(playerid, -1, ""er"Invalid store name length");

new count = 0;
for(new i = 0; i < MAX_STORES; i++) {
if(StoreData[i][e_ormid] != ORM:-1)
++count;
}

if(count >= MAX_STORES)
return SCM(playerid, -1, ""er"Max stores reached");

new r = -1;
for(new i = 0; i < MAX_STORES; i++) {
if(StoreData[i][e_ormid] == ORM:-1) {
r = i;
break;
}
}

if(r == -1) return SCM(playerid, -1, ""er"No free store slot");

new ORMrmid = StoreData[r][e_ormid] = orm_create("stores"),
Float:fPOS[4];

AssembleStoreORM(ormid, r);

GetPlayerPos(playerid, fPOS[0], fPOS[1], fPOS[2]);
GetPlayerFacingAngle(playerid, fPOS[3]);

StoreData[r][e_pick][0] = fPOS[0];
StoreData[r][e_pick][1] = fPOS[1];
StoreData[r][e_pick][2] = fPOS[2];

GetPosInFrontOfPlayer(playerid, fPOS[0], fPOS[1], -2.5);
StoreData[r][e_spawn][0] = fPOS[0];
StoreData[r][e_spawn][1] = fPOS[1];
StoreData[r][e_spawn][2] = fPOS[2];
StoreData[r][e_spawn][3] = floatround(floatadd(180.0, fPOS[3]), floatround_ceil);

StoreData[r][e_type] = E_STORE_TYPE:type;
StoreData[r][e_date] = gettime();
StoreData[r][e_creator] = PlayerData[playerid][e_accountid];
strcpy2(StoreData[r][e_name], gstr, MAX_STORE_NAME);

orm_setkey(ormid, "id");
orm_insert(ormid, "OnStoreLoadEx", "i", r);
return 1;
}
Reply
#6

Shown the cmd!
Reply
#7

BUMP please help me?
Reply
#8

BUMP
Reply
#9

Instead of bumping, use [ pawn] tag without the space. Your code is a massive pain to read.
Reply
#10

pawn Код:
CMD:screate(playerid, params[])
{
    if(!IsPlayerAdmin(playerid) || PlayerData[playerid][e_level] != MAX_ADMIN_LEVEL)
    {
        return SCM(playerid, -1, NO_PERM);
    }

    new type;
    if(sscanf(params, "is[143]", type, gstr))
    {
        SCM(playerid, NEF_GREEN, "STORE_TYPE_AMMUNATION, STORE_TYPE_BANK, STORE_TYPE_BURGERSHOT, STORE_TYPE_CLUCKINBELLS, STORE_TYPE_247, STORE_TYPE_STACKEDPIZZAS");
        return SCM(playerid, NEF_GREEN, "Usage: /screate <type> <name>");
    }

    if(type < 0 || type > 6)
    return SCM(playerid, -1, ""er"Invalid store type");

    if(strlen(gstr) < 3 || strlen(gstr) > MAX_STORE_NAME)
    return SCM(playerid, -1, ""er"Invalid store name length");

    new count = 0;
    for(new i = 0; i < MAX_STORES; i++) {
        if(StoreData[i][e_ormid] != ORM:-1)
        ++count;
    }

    if(count >= MAX_STORES)
    return SCM(playerid, -1, ""er"Max stores reached");

    new r = -1;
    for(new i = 0; i < MAX_STORES; i++) {
        if(StoreData[i][e_ormid] == ORM:-1) {
            r = i;
            break;
        }
    }

    if(r == -1) return SCM(playerid, -1, ""er"No free store slot");

    new ORM:ormid = StoreData[r][e_ormid] = orm_create("stores"),
    Float:fPOS[4];

    AssembleStoreORM(ormid, r);

    GetPlayerPos(playerid, fPOS[0], fPOS[1], fPOS[2]);
    GetPlayerFacingAngle(playerid, fPOS[3]);

    StoreData[r][e_pick][0] = fPOS[0];
    StoreData[r][e_pick][1] = fPOS[1];
    StoreData[r][e_pick][2] = fPOS[2];

    GetPosInFrontOfPlayer(playerid, fPOS[0], fPOS[1], -2.5);
    StoreData[r][e_spawn][0] = fPOS[0];
    StoreData[r][e_spawn][1] = fPOS[1];
    StoreData[r][e_spawn][2] = fPOS[2];
    StoreData[r][e_spawn][3] = floatround(floatadd(180.0, fPOS[3]), floatround_ceil);

    StoreData[r][e_type] = E_STORE_TYPE:type;
    StoreData[r][e_date] = gettime();
    StoreData[r][e_creator] = PlayerData[playerid][e_accountid];
    strcpy2(StoreData[r][e_name], gstr, MAX_STORE_NAME);

    orm_setkey(ormid, "id");
    orm_insert(ormid, "OnStoreLoadEx", "i", r);
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)