point name
#1

it compile good but not working good at game.
pawn Код:
CMD:pedit(playerid, params[])
{
    new String[128],
        point,
        name;
       if(!strcmp(params, "name", true, 4))
    {
        if(sscanf(params, "s[32]is[32]", params, point, name)) return SendClientMessage(playerid, 0xFF0000AA, "[Usage]:{FFFFFF} /pedit name [pointid] [name]");
        if(point < 1 || point > 6) return SendClientMessage(playerid, COLOR_GREY, "Points are between 1 and 6.");
        format(String, sizeof(String), "AdmWarn: %s has Changed %s point name to %s", RPN(playerid), RPON(point), name);
        SendAdminMessage(COLOR_DARKRED, 1, String);
        DestroyDynamic3DTextLabel(PointInfo[point][pText]);
        format(PointInfo[point][pName], 32, "%s", name);
        format(String, sizeof(String),"Point name: %s\nCapture Time: %d Hours\nOwner: %s\nProfit: %d\n Type /capture to attempet to capture it.",RPON(point),PointInfo[point][pTime],RFaN(PointInfo[point][pOwner]),PointInfo[point][pProfit]);
        PointInfo[point][pText] = CreateDynamic3DTextLabel(String, COLOR_YELLOW, PointInfo[point][pX], PointInfo[point][pY], PointInfo[point][pZ], 5);
    }
return 1;
}
any errors??
Reply
#2

Yes, first you must use 'sscanf' and then check if the strings coincide... Remaining like that:

pawn Код:
CMD:pedit(playerid, params[])
{
    new String[128], point, name;
   
    if(sscanf(params, "s[32]is[32]", params[0], point, name)) return SendClientMessage(playerid, 0xFF0000AA, "[Usage]:{FFFFFF} /pedit name [pointid] [name]");
    else if(strcmp(params[0], "name", true) == 0)
    {
        if(point < 1 || point > 6) return SendClientMessage(playerid, COLOR_GREY, "Points are between 1 and 6.");
        format(String, sizeof(String), "AdmWarn: %s has Changed %s point name to %s", RPN(playerid), RPON(point), name);
        SendAdminMessage(COLOR_DARKRED, 1, String);
        DestroyDynamic3DTextLabel(PointInfo[point][pText]);
        format(PointInfo[point][pName], 32, "%s", name);
        format(String, sizeof(String),"Point name: %s\nCapture Time: %d Hours\nOwner: %s\nProfit: %d\n Type /capture to attempet to capture it.",RPON(point),PointInfo[point][pTime],RFaN(PointInfo[point][pOwner]),PointInfo[point][pProfit]);
        PointInfo[point][pText] = CreateDynamic3DTextLabel(String, COLOR_YELLOW, PointInfo[point][pX], PointInfo[point][pY], PointInfo[point][pZ], 5);
    }
    return 1;
}

Also, As it will notice, I use 'param[0]' as variable.


Regards .
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)