Mini Help
#1

deletted
Reply
#2

First of all ... i have made your code properly:

PHP код:
new vowned[8];

CMD:cars(playerid,params[]) {
    new 
player1;
    if(
sscanf(params,"i",player1)) {
        new 
handle[770],string[128];
        
format(string,sizeof string,"{FFFF00}NickName : %s\n",pName(playerid));
        
strcat(handle,string);
        for(new 
0sizeof(vowned); i++)
        {
            new 
string[100];
            
format(string,sizeof(string),"\n{FFFFFF}Slot %i: Empty", (i+1));
            if(!
PlayerInfo[playerid][vowned[i]]) strcat(handle,string);
            
format(string,sizeof string,"\n{FFFFFF}Slot %i: {33FF33}%s {FFFFFF}ID: {33FF33}%d",(i+1),VehicleInfo[GetPlayerVehicleID(playerid)][name],GetPlayerVehicleID(playerid));
            
strcat(handle,string);
        }
        return 
ShowPlayerDialog(playerid0DIALOG_STYLE_MSGBOX"Player List"handle"Ok""");
    }
    new 
handle[770],string[128];
    
format(string,sizeof string,"{FFFF00}NickName : %s\n",pName(player1));
    
strcat(handle,string);
    for(new 
0sizeof(vowned); i++)
    {
        new 
string[100];
        
format(string,sizeof(string),"\n{FFFFFF}Slot %i: Empty", (i+1));
        if(!
PlayerInfo[player1][vowned[i]]) strcat(handle,string);
        
format(string,sizeof string,"\n{FFFFFF}Slot %i: {33FF33}%s {FFFFFF}ID: {33FF33}%d",(i+1),VehicleInfo[GetPlayerVehicleID(player1)][name],GetPlayerVehicleID(player1));
        
strcat(handle,string);
    }
    return 
ShowPlayerDialog(playerid0DIALOG_STYLE_MSGBOX"Player List"handle"Ok""");

so the one who wants to fix it doesn't have to vomit ^^
Reply
#3

and ofc it doesnt show the cars you own but the one you are driving , youa re using getPlayerVehicleID

and to me it looks like u mixed up the "player1" and "playerid" a bit
Reply
#4

After refreshing the page Marcel has already replied but since I wrote it, I'm going to post it anyway.

I don't know your code but I think "vowned_" holds the vehicle ID. If so, you need to use that instead of GetPlayerVehicleID.

As for the way you use it is very bad. What Marcel did with an array is the appropriate way to do stuff like that. In the enum that is used for the PlayerInfo array, you need to remove vowned, vowned2 ... vowned8 and add vowned[8]

Then all you have to do is:
PHP код:
CMD:cars(playeridparams[])
{
    new 
player1;
    if (
sscanf(params"i"player1)) player1 playerid;
    new 
handle[700], string[85];
    
format(handlesizeof handle"{FFFF00}NickName : %s\n"pName(player1));
    for (new 
i!= 8i++)
    {
        if (!
PlayerInfo[player1][vowned][i]) format(stringsizeof string"\n{FFFFFF}Slot %i: Empty"1);
        else 
format(stringsizeof string"\n{FFFFFF}Slot %i: {33FF33}%s {FFFFFF}ID: {33FF33}%d"1VehicleInfo[PlayerInfo[player1][vowned][i]][name], PlayerInfo[player1][vowned][i]);
        
strcat(handlestring);
    }
    
ShowPlayerDialog(playerid0DIALOG_STYLE_MSGBOX"Player List"handle"Ok""");
    return 
1;

Reply
#5

deletted
Reply
#6

deletted
Reply
#7

Anyone ??
Reply
#8

Of course it's always going to show that it's empty.
Count is set to 0, and you're only adding to it when it's set to 1.
Reply
#9

Quote:
Originally Posted by Stinged
Посмотреть сообщение
Of course it's always going to show that it's empty.
Count is set to 0, and you're only adding to it when it's set to 1.
okay sir can you show me a code ?? please
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)