Help please
#2

try this:
pawn Код:
CMD:createorg(playerid,params[])
{
    new orgid;
    new orggenre;
    new name[128];
    if(!IsPlayerAdmin(playerid)) return 0;
    if(sscanf(params,"iis",orgid,orggenre,name))
    {
        SendClientMessage(playerid,COLOR_ORED,"USAGE: /createorg [orgid] [genre] [name]");
        return 1;
    }
    if(orgid > MAX_ORGS)
    {
        SendClientMessage(playerid,COLOR_ORED,"Too high. Max org limitation exceed.");
        return 1;
    }
    new file[55];
    format(file,sizeof file,"org%d.ini",orgid);
    if(fexist(file))
    {
        SendClientMessage(playerid,COLOR_ORED,"Organization ID already in use.");
        return 1;
    }
    if(orggenre > 3 || orggenre < 1)
    {
        SendClientMessage(playerid,COLOR_ORED,"Only 3 genre avaliable.");
        return 1;
    }
    dini_Create(file);
    dini_Set(file,"Name",name);
    dini_IntSet(file,"Genre",orggenre);
    dini_IntSet(file,"Ammo",100);
    new str[256];
    format(str,256,"** You have created organization id %d, %s.",orgid,name);
    SendClientMessage(playerid,COLOR_YELLOW,str);
    return 1;
}


CMD:setorgveh(playerid,params[])
{
    new orgids;
    new cars;
    if(!IsPlayerAdmin(playerid)) return 0;
    if(sscanf(params,"ii",orgids,cars))
    {
        SendClientMessage(playerid,COLOR_ORED,"USAGE: /setorgveh [orgid] [car[1-8]]");
        return 1;
    }
    new filo[256];
    if(cars > 8 || cars < 1)
    {
        SendClientMessage(playerid,COLOR_ORED,"Car ID 1-8");
        return 1;
    }
    format(filo,256,"org%d.ini",orgids);
    if(!fexist(filo))
    {
        SendClientMessage(playerid,COLOR_ORED,"Organization ID doesnt exist.");
        return 1;
    }
    new Float:X,Float:Y,Float:Z,Float:A;
    if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER)
    {
        SendClientMessage(playerid,COLOR_ORED,"You aren't in any vehicle.");
        return 1;
    }
    GetVehiclePos(GetPlayerVehicleID(playerid),X,Y,Z);
    GetVehicleZAngle(GetPlayerVehicleID(playerid),A);
    if(cars == 1)
    {
        dini_IntSet(filo,"Model1",GetVehicleModel(GetPlayerVehicleID(playerid)));
        dini_FloatSet(filo,"X1",X);
        dini_FloatSet(filo,"Y1",Y);
        dini_FloatSet(filo,"Z1",Z);
        dini_FloatSet(filo,"A1",A);
        OrgInfo[orgids][Car1] = CreateVehicle(GetVehicleModel(GetPlayerVehicleID(playerid)),X,Y,Z,A,-1,-1,-1);
    }
    if(cars == 2)
    {
        dini_IntSet(filo,"Model2",GetVehicleModel(GetPlayerVehicleID(playerid)));
        dini_FloatSet(filo,"X2",X);
        dini_FloatSet(filo,"Y2",Y);
        dini_FloatSet(filo,"Z2",Z);
        dini_FloatSet(filo,"A2",A);
        OrgInfo[orgids][Car2] = CreateVehicle(GetVehicleModel(GetPlayerVehicleID(playerid)),X,Y,Z,A,-1,-1,-1);
    }
    if(cars == 3)
    {
        dini_IntSet(filo,"Model3",GetVehicleModel(GetPlayerVehicleID(playerid)));
        dini_FloatSet(filo,"X3",X);
        dini_FloatSet(filo,"Y3",Y);
        dini_FloatSet(filo,"Z3",Z);
        dini_FloatSet(filo,"A3",A);
        OrgInfo[orgids][Car3] = CreateVehicle(GetVehicleModel(GetPlayerVehicleID(playerid)),X,Y,Z,A,-1,-1,-1);
    }
    if(cars == 4)
    {
        dini_IntSet(filo,"Model4",GetVehicleModel(GetPlayerVehicleID(playerid)));
        dini_FloatSet(filo,"X4",X);
        dini_FloatSet(filo,"Y4",Y);
        dini_FloatSet(filo,"Z4",Z);
        dini_FloatSet(filo,"A4",A);
        OrgInfo[orgids][Car4] = CreateVehicle(GetVehicleModel(GetPlayerVehicleID(playerid)),X,Y,Z,A,-1,-1,-1);
    }
    if(cars == 5)
    {
        dini_IntSet(filo,"Model5",GetVehicleModel(GetPlayerVehicleID(playerid)));
        dini_FloatSet(filo,"X5",X);
        dini_FloatSet(filo,"Y5",Y);
        dini_FloatSet(filo,"Z5",Z);
        dini_FloatSet(filo,"A5",A);
        OrgInfo[orgids][Car5] = CreateVehicle(GetVehicleModel(GetPlayerVehicleID(playerid)),X,Y,Z,A,-1,-1,-1);
    }
    if(cars == 6)
    {
        dini_IntSet(filo,"Model6",GetVehicleModel(GetPlayerVehicleID(playerid)));
        dini_FloatSet(filo,"X6",X);
        dini_FloatSet(filo,"Y6",Y);
        dini_FloatSet(filo,"Z6",Z);
        dini_FloatSet(filo,"A6",A);
        OrgInfo[orgids][Car6] = CreateVehicle(GetVehicleModel(GetPlayerVehicleID(playerid)),X,Y,Z,A,-1,-1,-1);
    }
    if(cars == 7)
    {
        dini_IntSet(filo,"Model7",GetVehicleModel(GetPlayerVehicleID(playerid)));
        dini_FloatSet(filo,"X7",X);
        dini_FloatSet(filo,"Y7",Y);
        dini_FloatSet(filo,"Z7",Z);
        dini_FloatSet(filo,"A7",A);
        OrgInfo[orgids][Car7] = CreateVehicle(GetVehicleModel(GetPlayerVehicleID(playerid)),X,Y,Z,A,-1,-1,-1);
    }
    if(cars == 8)
    {
        dini_IntSet(filo,"Model8",GetVehicleModel(GetPlayerVehicleID(playerid)));
        dini_FloatSet(filo,"X8",X);
        dini_FloatSet(filo,"Y8",Y);
        dini_FloatSet(filo,"Z8",Z);
        dini_FloatSet(filo,"A8",A);
        OrgInfo[orgids][Car8] = CreateVehicle(GetVehicleModel(GetPlayerVehicleID(playerid)),X,Y,Z,A,-1,-1,-1);
    }
    new sl[256];
    format(sl,256,"** You have set vehicle id %d to organization vehicle, %s (Carid:%d).",GetVehicleModel(GetPlayerVehicleID(playerid)),dini_Get(filo,"Name"),cars);
    SendClientMessage(playerid,COLOR_MAIN,sl);
    return 1;
}
   
CMD:setorgskin(playerid,params[])
{
    if(!IsPlayerAdmin(playerid)) return 0;
    new orgido;
    new wichskin;
    new skinid;
    if(sscanf(params,"iii",orgido,wichskin,skinid))
    {
        SendClientMessage(playerid,COLOR_ORED,"USAGE: /setorgskin [ORGID] [Skin [1-2]] [SkinID]");
        return 1;
    }
    new filo[256];
    format(filo,256,"org%d.ini",orgido);
    if(!fexist(filo))
    {
        SendClientMessage(playerid,COLOR_ORED,"Organization ID doesnt exist.");
        return 1;
    }
    if(wichskin < 1 || wichskin > 2)
    {
        SendClientMessage(playerid,COLOR_ORED,"Please choose between 1-2 for skin id.");
        return 1;
    }
    if(wichskin == 1)
    {
    dini_IntSet(filo,"Skin1",skinid);
    }
    if(wichskin == 2)
    {
    dini_IntSet(filo,"Skin2",skinid);
    }
    new stringo[256];
    format(stringo,256,"** You have sucessfully changed the skin to skin id %d.",skinid);
    SendClientMessage(playerid,COLOR_MAIN,stringo);
    return 1;
}
CMD:setorgcol(playerid,params[])
{
    if(!IsPlayerAdmin(playerid)) return 0;
    new orgid;
    new newcol[200];
    if(sscanf(params,"is",orgid,newcol))
    {
        SendClientMessage(playerid,COLOR_ORED,"USAGE: /setorgcol [orgid] [newcol]");
        return 1;
    }
    new format1[256];
    new filo[256];
    format(filo,256,"org%d.ini",orgid);
    if(!fexist(filo))
    {
        SendClientMessage(playerid,COLOR_ORED,"Organization ID doesnt exist.");
        return 1;
    }
    format(format1,256,"** You have sucessfully change organization %s color id to %s.",dini_Get(filo,"Name"),newcol);
    SendClientMessage(playerid,COLOR_MAIN,format1);
    dini_Set(filo,"Color",newcol);
    return 1;
}

CMD:setorggenre(playerid,params[])
{
    if(!IsPlayerAdmin(playerid)) return 0;
    new orgname;
    new genre;
    if(sscanf(params,"ii",orgname,genre))
    {
        SendClientMessage(playerid,COLOR_ORED,"USAGE: /setorggenre [orgid] [genre][1-3]");
        return 1;
    }

    if(!genre || genre > 3 || genre < 1)
    {
        SendClientMessage(playerid,COLOR_ORED,"Genre 1-3");
        return 1;
    }
    if(OrgInfo[orgname][Genre] == genre)
    {
        SendClientMessage(playerid,COLOR_ORED,"That organization is already in this genre.");
        return 1;
    }
    new filo[256];
    format(filo,55,"org%d.ini",orgname);
    if(!fexist(filo))
    {
        SendClientMessage(playerid,COLOR_ORED,"Organization id doesnt exist.");
        return 1;
    }
    dini_IntSet(filo,"Genre",genre);
    OrgInfo[orgname][Genre] = genre;
    return 1;
}
CMD:setorgcarcol(playerid,params[])
{
    if(!IsPlayerAdmin(playerid)) return 0;
    new orgid12;
    new col1;
    new col2;
    if(sscanf(params,"iii",orgid12,col1,col2))
    {
        SendClientMessage(playerid,COLOR_ORED,"USAGE: /setorgcol [orgid] [col1] [col2]");
        return 1;
    }
    new filo[256];
    format(filo,256,"org%d.ini",orgid12);
    if(!fexist(filo))
    {
        SendClientMessage(playerid,COLOR_ORED,"Organization ID doesnt exist.");
        return 1;
    }
    dini_IntSet(filo,"Col1",col1);
    dini_IntSet(filo,"Col2",col2);
    ChangeVehicleColor(OrgInfo[orgid12][Car1],col1,col2);
    ChangeVehicleColor(OrgInfo[orgid12][Car2],col1,col2);
    ChangeVehicleColor(OrgInfo[orgid12][Car3],col1,col2);
    ChangeVehicleColor(OrgInfo[orgid12][Car4],col1,col2);
    ChangeVehicleColor(OrgInfo[orgid12][Car5],col1,col2);
    ChangeVehicleColor(OrgInfo[orgid12][Car6],col1,col2);
    ChangeVehicleColor(OrgInfo[orgid12][Car7],col1,col2);
    ChangeVehicleColor(OrgInfo[orgid12][Car8],col1,col2);
    SendClientMessage(playerid,COLOR_ORED,"Sucessfully change vehicle color.");
    return 1;
}

CMD:setorgname(playerid,params[])
{
    if(!IsPlayerAdmin(playerid)) return 0;
    new orgID;
    new name[200];
    if(sscanf(params,"is",orgID,name))
    {
        SendClientMessage(playerid,COLOR_ORED,"UASGE: /setorgname [OrgID] [New Name]");
        return 1;
    }
    new filo[256];
    format(filo,256,"org%d.ini",orgID);
    if(!fexist(filo))
    {
        SendClientMessage(playerid,COLOR_ORED,"That organization ID doesnt exist.");
        return 1;
    }
    dini_Set(filo,"Name",name);
    new fm2[256];
    format(fm2,256,"** You have sucessfully changed the organization name to %s.",name);
    SendClientMessage(playerid,COLOR_MAIN,fm2);
    return 1;
}
im not too good with strtok, but i think that will work
Reply


Messages In This Thread
Help please - by XxX(cena)XxX - 22.04.2012, 00:44
Re: Help please - by MeDaKewlDude - 22.04.2012, 01:20

Forum Jump:


Users browsing this thread: 1 Guest(s)