SA-MP Forums Archive
Whats wrong with this script? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Whats wrong with this script? (/showthread.php?tid=260758)



Whats wrong with this script? - patfay - 10.06.2011

Alright well I made a command that changes the business name, but when I type the command it shows the syntax, and if I type it correctly, it says Invalid business id (When it is the correct ID)
pawn Код:
command(setbusinessname, playerid, params[])
{
    new Name[255], id, string[128];
    if(sscanf(params, "z", id, Name)) {
        if(Player[playerid][AdminLevel] >= 4) {
            SendClientMessage(playerid, WHITE, "/setbusinessname [businessid] [Name]");
        }
    }
    else {
        if(Player[playerid][AdminLevel] >= 4) {
            format(string, sizeof(string), "Businesses/Business_%d.ini", id);

            if(!fexist(string)) {
                SendClientMessage(playerid, WHITE, "Invalid business ID!");
                return 1;
            }
            else {
                Businesses[id][bName] = Name;
                SaveBusiness(id);
                format(string, sizeof(string), "You have set the business name to %d.", Name);
                SendClientMessage(playerid, WHITE, string);
            }
        }
    }
    return 1;
}
Using vortex script if anyone can figure it out


Re: Whats wrong with this script? - Calgon - 10.06.2011

You haven't made that command, you've destroyed perfectly functioning code.

Change:
pawn Код:
if(sscanf(params, "z", id, Name)) {
to:

pawn Код:
if(sscanf(params, "ds", id, Name)) {



Re: Whats wrong with this script? - patfay - 10.06.2011

Well I didnt make it 100 percently, I took two commands and combined them together