Help | /buyprods /sellprods /load
#1

i have a bug with 3 commands and i can't fix them ;(

PHP Code:
    if(strcmp(cmd"/load"true) == 0)
    {
        if(
IsPlayerConnected(playerid))
        {
            new 
tmpcar GetPlayerVehicleID(playerid);
            if(
tmpcar >= 192 || tmpcar <= 195)
            {
                
GameTextForPlayer(playerid"~r~You are not in a delivery truck"50001);
                return 
1;
            }
            
format(stringsizeof(string), "Products: %d/%d."PlayerHaul[tmpcar][pLoad],PlayerHaul[tmpcar][pCapasity]);
            
SendClientMessage(playeridTEAM_GROVE_COLORstring);
        }
        return 
1;
    }
    if(
strcmp(cmd"/buyprods"true) == 0)
    {
        if(
IsPlayerConnected(playerid))
        {
            new 
tmpcar GetPlayerVehicleID(playerid);
            new 
compcost 20;
            if(
PlayerToPoint(70.0playerid2468.4919,-2092.9902,13.5469))
            {
                if(
IsATruck(tmpcar))
                {
                    if(
PlayerHaul[tmpcar][pLoad] < PlayerHaul[tmpcar][pCapasity])
                    {
                        new 
amount;
                        
tmp strtok(cmdtextidx);
                        if(!
strlen(tmp))
                        {
                            
SendClientMessage(playeridCOLOR_GRAD1"USAGE: /buyprods [amount]");
                            return 
1;
                        }
                        
amount strval(tmp);
                        if(
amount || amount 500) { SendClientMessage(playeridCOLOR_GREY"   Can't buy less then 1 Product or more then 500!"); return 1; }
                        new 
checkPlayerHaul[tmpcar][pLoad] + amount;
                        if(
check PlayerHaul[tmpcar][pCapasity])
                        {
                            
format(stringsizeof(string), "   You went over the Truck Products Carry Limit of %d, you currently carry %d.",PlayerHaul[tmpcar][pCapasity],PlayerHaul[tmpcar][pLoad]);
                            
SendClientMessage(playeridCOLOR_GREYstring);
                            return 
1;
                        }
                        new 
cost amount*compcost;
                        if(
GetCash(playerid) >= cost)
                        {
                            
PlayerHaul[tmpcar][pLoad] += amount;
                            
format(stringsizeof(string), "Products: %d/%d."PlayerHaul[tmpcar][pLoad],PlayerHaul[tmpcar][pCapasity]);
                            
SendClientMessage(playeridTEAM_GROVE_COLORstring);
                            
format(stringsizeof(string), "You bought %d Products for $%d."amount,cost);
                            
SendClientMessage(playeridTEAM_GROVE_COLORstring);
                            
GiveCash(playerid,-cost);
                            
PlayerPlaySound(playerid10520.00.00.0);
                            return 
1;
                        }
                        else
                        {
                            
format(stringsizeof(string), "You cant afford %d Products at $%d!"amount,cost);
                            
SendClientMessage(playeridTEAM_GROVE_COLORstring);
                            return 
1;
                        }
                    }
                    else
                    {
                            
format(stringsizeof(string), "Products: %d/%d."PlayerHaul[tmpcar][pLoad],PlayerHaul[tmpcar][pCapasity]);
                            
SendClientMessage(playeridTEAM_GROVE_COLORstring);
                            return 
1;
                    }
                }
                else
                {
                    
SendClientMessage(playeridTEAM_GROVE_COLOR"This Vehicle does not deliver Products.");
                    return 
1;
                }
            }
            else
            {
                
SendClientMessage(playeridCOLOR_GREY"You are not in trucker place.");
                return 
1;
            }
        }
        return 
1;
    }
    if(
strcmp(cmd"/sellprods"true) == 0)
    {
        new 
cashmade;
        new 
tmpcar;
        if(
IsPlayerConnected(playerid))
        {
            
tmpcar GetPlayerVehicleID(playerid);
            if(!
IsATruck(tmpcar))
            {
                
GameTextForPlayer(playerid"~r~You are not in a delivery truck"50001);
                return 
1;
            }
            if(
PlayerHaul[tmpcar][pLoad] == 0)
            {
                
GameTextForPlayer(playerid"~r~Truck is empty, return to the stock house"50001);
                
format(stringsizeof(string), "Products: %d/%d."PlayerHaul[tmpcar][pLoad],PlayerHaul[tmpcar][pCapasity]);
                
SendClientMessage(playeridTEAM_GROVE_COLORstring);
                return 
1;
            }
            for(new 
0sizeof(BizzInfo); i++)
            {
                if (
PlayerToPoint(10playerid,BizzInfo[i][bEntranceX], BizzInfo[i][bEntranceY], BizzInfo[i][bEntranceZ]))
                {
                    
//printf("Found House :%d",i);
                    
for(new PlayerHaul[tmpcar][pLoad]; 0l--)
                    {
                        if(
BizzInfo[i][bProducts] == BizzInfo[i][bMaxProducts])
                        {
                            
GameTextForPlayer(playerid"~r~Our stores are full"50001);
                            
format(stringsizeof(string), "Cash Earned $%d."cashmade);
                            
SendClientMessage(playeridTEAM_GROVE_COLORstring);
                            
format(stringsizeof(string), "Products: %d/%d."PlayerHaul[tmpcar][pLoad],PlayerHaul[tmpcar][pCapasity]);
                            
SendClientMessage(playeridTEAM_GROVE_COLORstring);
                            
PlayerPlaySound(playerid10520.00.00.0);
                            return 
1;
                        }
                        if(
BizzInfo[i][bPriceProd] > BizzInfo[i][bTill])
                        {
                            
GameTextForPlayer(playerid"~r~We Cant Afford The Deal"50001);
                            
format(stringsizeof(string), "Cash Earned $%d."cashmade);
                            
SendClientMessage(playeridTEAM_GROVE_COLORstring);
                            
format(stringsizeof(string), "Products: %d/%d."PlayerHaul[tmpcar][pLoad],PlayerHaul[tmpcar][pCapasity]);
                            
SendClientMessage(playeridTEAM_GROVE_COLORstring);
                            
PlayerPlaySound(playerid10520.00.00.0);
                            return 
1;
                        }
                        
PlayerHaul[tmpcar][pLoad]--;
                        
BizzInfo[i][bProducts]++;
                        
cashmade cashmade+BizzInfo[i][bPriceProd];
                        
//ConsumingMoney[playerid] = 1;
                        
GiveCash(playerid,BizzInfo[i][bPriceProd]);
                        
BizzInfo[i][bTill] -= BizzInfo[i][bPriceProd];
                        if(
PlayerHaul[tmpcar][pLoad] == 0)
                        {
                            
GameTextForPlayer(playerid"~r~Truck is empty, return to the stock house"50001);
                            
format(stringsizeof(string), "Cash Earned $%d."cashmade);
                            
SendClientMessage(playeridTEAM_GROVE_COLORstring);
                            
format(stringsizeof(string), "Products: %d/%d."PlayerHaul[tmpcar][pLoad],PlayerHaul[tmpcar][pCapasity]);
                            
SendClientMessage(playeridTEAM_GROVE_COLORstring);
                            
PlayerPlaySound(playerid10520.00.00.0);
                            return 
1;
                        }
                    }
                    
OnPropUpdate();
                    return 
1;
                }
            }
        }
        for(new 
0sizeof(SBizzInfo); i++)
        {
            if (
PlayerToPoint(10playerid,SBizzInfo[i][sbEntranceX], SBizzInfo[i][sbEntranceY], SBizzInfo[i][sbEntranceZ]))
            {
                
//printf("Found House :%d",i);
                
for(new PlayerHaul[tmpcar][pLoad]; 0l--)
                {
                    if(
SBizzInfo[i][sbProducts] == SBizzInfo[i][sbMaxProducts])
                    {
                        
GameTextForPlayer(playerid"~r~Our stores are full"50001);
                        
format(stringsizeof(string), "Cash Earned $%d."cashmade);
                        
SendClientMessage(playeridTEAM_GROVE_COLORstring);
                        
format(stringsizeof(string), "Products: %d/%d."PlayerHaul[tmpcar][pLoad],PlayerHaul[tmpcar][pCapasity]);
                        
SendClientMessage(playeridTEAM_GROVE_COLORstring);
                        return 
1;
                    }
                    if(
SBizzInfo[i][sbPriceProd] > SBizzInfo[i][sbTill])
                    {
                        
GameTextForPlayer(playerid"~r~We Cant Afford The Deal"50001);
                        
format(stringsizeof(string), "Cash Earned $%d."cashmade);
                        
SendClientMessage(playeridTEAM_GROVE_COLORstring);
                        
format(stringsizeof(string), "Products: %d/%d."PlayerHaul[tmpcar][pLoad],PlayerHaul[tmpcar][pCapasity]);
                        
SendClientMessage(playeridTEAM_GROVE_COLORstring);
                        return 
1;
                    }
                    
PlayerHaul[tmpcar][pLoad]--;
                    
SBizzInfo[i][sbProducts]++;
                    
cashmade cashmade+SBizzInfo[i][sbPriceProd];
                    
//ConsumingMoney[playerid] = 1;
                    
GiveCash(playerid,SBizzInfo[i][sbPriceProd]);
                    
SBizzInfo[i][sbTill] -= SBizzInfo[i][sbPriceProd];
                    if(
PlayerHaul[tmpcar][pLoad] == 0)
                    {
                        
GameTextForPlayer(playerid"~r~Truck is empty, return to the stock house"50001);
                        
format(stringsizeof(string), "Cash Earned $%d."cashmade);
                        
SendClientMessage(playeridTEAM_GROVE_COLORstring);
                        
format(stringsizeof(string), "Products: %d/%d."PlayerHaul[tmpcar][pLoad],PlayerHaul[tmpcar][pCapasity]);
                        
SendClientMessage(playeridTEAM_GROVE_COLORstring);
                        return 
1;
                    }
                }
                
OnPropUpdate();
                return 
1;
            }
        }
        
GameTextForPlayer(playerid"~r~To Far From A Business"50001);
        return 
1;
    } 
Hey, i got problem with 3 commands, the commands doesn't work ..
SERVER : Unknown Command
please helpppp
Reply
#2

Any warnings errors ?
Reply
#3

Ok, that's form Raven's RolePlay....
Huh.... First you need to define Trucks for this job....Ok lets start :P

Find this and delete it:
PlayerHaul[108][pCapasity] = 100;
PlayerHaul[109][pCapasity] = 100;
PlayerHaul[110][pCapasity] = 50;
PlayerHaul[111][pCapasity] = 50;

Add this at the top
new truckercar[2];
new truckercars[2];

Than....
Find this cars and add the red part in fornt of them

truckercars[0] = AddStaticVehicleEx(456,2508.9116,-2111.7759,13.7206,0,-1,-1, 30000); // Component Truck Yankee 108
truckercars[1] = AddStaticVehicleEx(456,2484.5356,-2111.7759,13.7196,0,-1,-1,VEHICLE_RESPAWN); // Component Truck Yankee 109
truckercar[0] = AddStaticVehicleEx(440,2529.0413,-2085.3999,13.6651,90,-1,-1,VEHICLE_RESPAWN); // Component Truck Rumpo 110
truckercar[1] = AddStaticVehicleEx(440,2528.9482,-2092.6104,13.6631,90,-1,-1,VEHICLE_RESPAWN); // Component Truck Rumpo 111

Than
OnGameModeInit
pawn Code:
for(new i = 0; i < MAX_VEHICLES; i ++)
    {
        if(IsATrucks(i))
        {
            PlayerHaul[i][pCapasity] = 200;
        }
    }
    for(new i = 0; i < MAX_VEHICLES; i ++)
    {
        if(IsATruck(i))
        {
            PlayerHaul[i][pCapasity] = 100;
        }
    }
forward IsATruck(carid);
forward IsATrucks(carid);
pawn Code:
public IsATruck(carid)
{
    for(new i = 0; i < sizeof(truckercar); i++)
    {
        if(carid == truckercar[i])  return 1;
    }
    return 0;
}
public IsATrucks(carid)
{
    for(new i = 0; i < sizeof(truckercars); i++)
    {
        if(carid == truckercars[i]) return 1;
    }
    return 0;
}
And Change your commands...
pawn Code:
if(strcmp(cmd, "/load", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            new tmpcar = GetPlayerVehicleID(playerid);
            if(!(IsATruck(tmpcar) || IsATrucks(tmpcar)))
            {
                GameTextForPlayer(playerid, "~r~You are not in a delivery truck", 5000, 1);
                return 1;
            }
            format(string, sizeof(string), "Products: %d/%d.", PlayerHaul[tmpcar][pLoad],PlayerHaul[tmpcar][pCapasity]);
            SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
        }
        return 1;
    }
    if(strcmp(cmd, "/buyprods", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            new tmpcar = GetPlayerVehicleID(playerid);
            new compcost = 20;
            if(PlayerToPoint(70.0, playerid, 2468.4919,-2092.9902,13.5469))
            {
                if(IsATruck(tmpcar) || IsATrucks(tmpcar))
                {
                    if(PlayerHaul[tmpcar][pLoad] < PlayerHaul[tmpcar][pCapasity])
                    {
                        new amount;
                        tmp = strtok(cmdtext, idx);
                        if(!strlen(tmp))
                        {
                            SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /buyprods [amount]");
                            return 1;
                        }
                        amount = strval(tmp);
                        if(amount < 1 || amount > 500) { SendClientMessage(playerid, COLOR_GREY, "   Can't buy less then 1 Product or more then 500!"); return 1; }
                        new check= PlayerHaul[tmpcar][pLoad] + amount;
                        if(check > PlayerHaul[tmpcar][pCapasity])
                        {
                            format(string, sizeof(string), "   You went over the Truck Products Carry Limit of %d, you currently carry %d.",PlayerHaul[tmpcar][pCapasity],PlayerHaul[tmpcar][pLoad]);
                            SendClientMessage(playerid, COLOR_GREY, string);
                            return 1;
                        }
                        new cost = amount*compcost;
                        if(GetCash(playerid) >= cost)
                        {
                            PlayerHaul[tmpcar][pLoad] += amount;
                            format(string, sizeof(string), "Products: %d/%d.", PlayerHaul[tmpcar][pLoad],PlayerHaul[tmpcar][pCapasity]);
                            SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
                            format(string, sizeof(string), "You bought %d Products for $%d.", amount,cost);
                            SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
                            GiveCash(playerid,-cost);
                            PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
                            return 1;
                        }
                        else
                        {
                            format(string, sizeof(string), "You cant afford %d Products at $%d!", amount,cost);
                            SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
                            return 1;
                        }
                    }
                    else
                    {
                            format(string, sizeof(string), "Products: %d/%d.", PlayerHaul[tmpcar][pLoad],PlayerHaul[tmpcar][pCapasity]);
                            SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
                            return 1;
                    }
                }
                else
                {
                    SendClientMessage(playerid, TEAM_GROVE_COLOR, "This Vehicle does not deliver Products.");
                    return 1;
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY, "You are not in trucker place.");
                return 1;
            }
        }
        return 1;
    }
    if(strcmp(cmd, "/sellprods", true) == 0)
    {
        new cashmade;
        new tmpcar;
        if(IsPlayerConnected(playerid))
        {
            tmpcar = GetPlayerVehicleID(playerid);
            if(!(IsATruck(tmpcar) || IsATrucks(tmpcar)))
            {
                GameTextForPlayer(playerid, "~r~You are not in a delivery truck", 5000, 1);
                return 1;
            }
            if(PlayerHaul[tmpcar][pLoad] == 0)
            {
                GameTextForPlayer(playerid, "~r~Truck is empty, return to the stock house", 5000, 1);
                format(string, sizeof(string), "Products: %d/%d.", PlayerHaul[tmpcar][pLoad],PlayerHaul[tmpcar][pCapasity]);
                SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
                return 1;
            }
            for(new i = 0; i < sizeof(BizzInfo); i++)
            {
                if (PlayerToPoint(10, playerid,BizzInfo[i][bEntranceX], BizzInfo[i][bEntranceY], BizzInfo[i][bEntranceZ]))
                {
                    //printf("Found House :%d",i);
                    for(new l = PlayerHaul[tmpcar][pLoad]; l > 0; l--)
                    {
                        if(BizzInfo[i][bProducts] == BizzInfo[i][bMaxProducts])
                        {
                            GameTextForPlayer(playerid, "~r~Our stores are full", 5000, 1);
                            format(string, sizeof(string), "Cash Earned $%d.", cashmade);
                            SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
                            format(string, sizeof(string), "Products: %d/%d.", PlayerHaul[tmpcar][pLoad],PlayerHaul[tmpcar][pCapasity]);
                            SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
                            PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
                            return 1;
                        }
                        if(BizzInfo[i][bPriceProd] > BizzInfo[i][bTill])
                        {
                            GameTextForPlayer(playerid, "~r~We Cant Afford The Deal", 5000, 1);
                            format(string, sizeof(string), "Cash Earned $%d.", cashmade);
                            SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
                            format(string, sizeof(string), "Products: %d/%d.", PlayerHaul[tmpcar][pLoad],PlayerHaul[tmpcar][pCapasity]);
                            SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
                            PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
                            return 1;
                        }
                        PlayerHaul[tmpcar][pLoad]--;
                        BizzInfo[i][bProducts]++;
                        cashmade = cashmade+BizzInfo[i][bPriceProd];
                        //ConsumingMoney[playerid] = 1;
                        GiveCash(playerid,BizzInfo[i][bPriceProd]);
                        BizzInfo[i][bTill] -= BizzInfo[i][bPriceProd];
                        if(PlayerHaul[tmpcar][pLoad] == 0)
                        {
                            GameTextForPlayer(playerid, "~r~Truck is empty, return to the stock house", 5000, 1);
                            format(string, sizeof(string), "Cash Earned $%d.", cashmade);
                            SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
                            format(string, sizeof(string), "Products: %d/%d.", PlayerHaul[tmpcar][pLoad],PlayerHaul[tmpcar][pCapasity]);
                            SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
                            PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
                            return 1;
                        }
                    }
                    OnPropUpdate();
                    return 1;
                }
            }
        }
        for(new i = 0; i < sizeof(SBizzInfo); i++)
        {
            if (PlayerToPoint(10, playerid,SBizzInfo[i][sbEntranceX], SBizzInfo[i][sbEntranceY], SBizzInfo[i][sbEntranceZ]))
            {
                //printf("Found House :%d",i);
                for(new l = PlayerHaul[tmpcar][pLoad]; l > 0; l--)
                {
                    if(SBizzInfo[i][sbProducts] == SBizzInfo[i][sbMaxProducts])
                    {
                        GameTextForPlayer(playerid, "~r~Our stores are full", 5000, 1);
                        format(string, sizeof(string), "Cash Earned $%d.", cashmade);
                        SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
                        format(string, sizeof(string), "Products: %d/%d.", PlayerHaul[tmpcar][pLoad],PlayerHaul[tmpcar][pCapasity]);
                        SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
                        return 1;
                    }
                    if(SBizzInfo[i][sbPriceProd] > SBizzInfo[i][sbTill])
                    {
                        GameTextForPlayer(playerid, "~r~We Cant Afford The Deal", 5000, 1);
                        format(string, sizeof(string), "Cash Earned $%d.", cashmade);
                        SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
                        format(string, sizeof(string), "Products: %d/%d.", PlayerHaul[tmpcar][pLoad],PlayerHaul[tmpcar][pCapasity]);
                        SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
                        return 1;
                    }
                    PlayerHaul[tmpcar][pLoad]--;
                    SBizzInfo[i][sbProducts]++;
                    cashmade = cashmade+SBizzInfo[i][sbPriceProd];
                    //ConsumingMoney[playerid] = 1;
                    GiveCash(playerid,SBizzInfo[i][sbPriceProd]);
                    SBizzInfo[i][sbTill] -= SBizzInfo[i][sbPriceProd];
                    if(PlayerHaul[tmpcar][pLoad] == 0)
                    {
                        GameTextForPlayer(playerid, "~r~Truck is empty, return to the stock house", 5000, 1);
                        format(string, sizeof(string), "Cash Earned $%d.", cashmade);
                        SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
                        format(string, sizeof(string), "Products: %d/%d.", PlayerHaul[tmpcar][pLoad],PlayerHaul[tmpcar][pCapasity]);
                        SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
                        return 1;
                    }
                }
                OnPropUpdate();
                return 1;
            }
        }
        GameTextForPlayer(playerid, "~r~To Far From A Business", 5000, 1);
        return 1;
    }
This will work 100%, i'm using ravens rp on my server....
Reputation please + Thank you
Reply
#4

Trying now ^_^
Ty..

EDIT:
It's not working too...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)