Can you tell me what is the include and declarations of this code
#1

if(strcmp(cmdtext, "/briefcase", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pBCase] == 1)
{
if(BCase[playerid] == 0)
{
SetPlayerHoldingObject(playerid, 1210, 6,0.3,0.1,0,0,-90,0); // BriefCase
SendClientMessage(playerid, COLOR_WHITE, " You have pulled out your briefcase. ");
BCase[playerid] = 1;
return 1;
}
else if(BCase[playerid] == 1)
{
StopPlayerHoldingObject(playerid);
SendClientMessage(playerid, COLOR_WHITE, " You have put away your briefcase. ");
BCase[playerid] = 0;
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD2, " You don't own a briefcase !");
return 1;
}
return 1;
}
return 1;
}
Reply
#2

that use 'a_samp' include ... You also need that array 'BCase'

Код HTML:
// At the beginning of the script under #includes & #defines

new BCase[MAX_PLAYERS];
Reply
#3

C:\Users\Hazi\Desktop\br.pwn(101) : error 017: undefined symbol "PlayerInfo"
C:\Users\Hazi\Desktop\br.pwn(101) : warning 215: expression has no effect
C:\Users\Hazi\Desktop\br.pwn(101) : error 001: expected token: ";", but found "]"
C:\Users\Hazi\Desktop\br.pwn(101) : error 029: invalid expression, assumed zero
C:\Users\Hazi\Desktop\br.pwn(101) : fatal error 107: too many error messages on one line


it still says that in 101 line
the line is...
if(PlayerInfo[playerid][pBCase] == 1)
Reply
#4

Quote:
Originally Posted by Hazi38
Посмотреть сообщение
if(strcmp(cmdtext, "/briefcase", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pBCase] == 1)
{
if(BCase[playerid] == 0)
{
SetPlayerHoldingObject(playerid, 1210, 6,0.3,0.1,0,0,-90,0); // BriefCase
SendClientMessage(playerid, COLOR_WHITE, " You have pulled out your briefcase. ");
BCase[playerid] = 1;
return 1;
}
else if(BCase[playerid] == 1)
{
StopPlayerHoldingObject(playerid);
SendClientMessage(playerid, COLOR_WHITE, " You have put away your briefcase. ");
BCase[playerid] = 0;
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD2, " You don't own a briefcase !");
return 1;
}
return 1;
}
return 1;
}
You have half of the array has not been declared, and that is causing the error.

PHP код:
enum E_PlayerInfo // declaration enumerator
    
pBCase //var1
    // var2
    // var3
    // etc...
}
new 
PlayerInfo[MAX_PLAYERS][E_PlayerInfo]; // declaration array1!
new BCase[MAX_PLAYERS]; // declaration array2!
if(strcmp(cmdtext"/briefcase"true) == 0)
{
    if(
IsPlayerConnected(playerid))
    {
        if(
PlayerInfo[playerid][pBCase] == 1)
        {
            if(
BCase[playerid] == 0)
            {
                
SetPlayerHoldingObject(playerid12106,0.3,0.1,0,0,-90,0); // BriefCase
                
SendClientMessage(playeridCOLOR_WHITE" You have pulled out your briefcase. ");
                
BCase[playerid] = 1;
                return 
1;
            } else if(
BCase[playerid] == 1)
            {
                
StopPlayerHoldingObject(playerid);
                
SendClientMessage(playeridCOLOR_WHITE" You have put away your briefcase. ");
                
BCase[playerid] = 0;
                return 
1;
            }
        } else {
            
SendClientMessage(playeridCOLOR_GRAD2" You don't own a briefcase !");
            return 
1;
        }
        return 
1;
    }
    return 
1;

Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)