SA-MP Forums Archive
NEED help when am running a command! - 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: NEED help when am running a command! (/showthread.php?tid=657052)



NEED help when am running a command! - Satish1 - 30.07.2018

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


Re: NEED help when am running a command! - GRiMMREAPER - 30.07.2018

Show us the /screate command.


Re: NEED help when am running a command! - Satish1 - 31.07.2018

How will I show you it lol?

Anyone help


Re: NEED help when am running a command! - AndreProgrammer - 31.07.2018

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


Re: NEED help when am running a command! - Satish1 - 31.07.2018

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;
}


Re: NEED help when am running a command! - Satish1 - 31.07.2018

Shown the cmd!


Re: NEED help when am running a command! - Satish1 - 01.08.2018

BUMP please help me?


Re: NEED help when am running a command! - Satish1 - 01.08.2018

BUMP


Re: NEED help when am running a command! - Rufio - 02.08.2018

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


Re: NEED help when am running a command! - Satish1 - 13.08.2018

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;
}