/contract fix.
#1

pawn Код:
CMD:contract(playerid, params[]) {
    if(playerVariables[playerid][pAdminDuty] == 1) {
    SendClientMessage(playerid, COLOR_RED, "You can not contract somebody while on administrator duty.");
    else //Invalid expression, assuming 0.
    new contracted, //Expected token ";" , found "new".
        contractreason,
        contractprice; //Error, Never used.
    contracted = playerid
    contractreason = "" //Empty Statement [start]
    SendClientMessage(playerid, COLOR_GREY, "You have contracted %d for %d. Reason: %d.", contracted, contractprice, contractreason);
    }
    if(playerVariables[playerid][pGroup] == 10); //Empty Statement [end]
    playerVariables[contracted][pContracted] = 1;
    SendClientMessage(playerid, COLOR_NICESKY, "Somebody has requested a contract on %d for %d. Reason: %d. ((If the reason isn't valid, ignore the contract.))", contracted, contractprice, contractreason);
    }
}
That's the contract code, and I get these errors:
pawn Код:
C:\Users\Admin\Desktop\Server Uploads\vx-rp.pwn(4032) : warning 203: symbol is never used: "wantedreason"
C:\Users\Admin\Desktop\Server Uploads\vx-rp.pwn(4041) : error 029: invalid expression, assumed zero
C:\Users\Admin\Desktop\Server Uploads\vx-rp.pwn(4041 -- 4042) : warning 215: expression has no effect
C:\Users\Admin\Desktop\Server Uploads\vx-rp.pwn(4042) : error 001: expected token: ";", but found "new"
C:\Users\Admin\Desktop\Server Uploads\vx-rp.pwn(4046) : error 001: expected token: ";", but found "-identifier-"
C:\Users\Admin\Desktop\Server Uploads\vx-rp.pwn(4046 -- 4047) : error 006: must be assigned to an array
C:\Users\Admin\Desktop\Server Uploads\vx-rp.pwn(4044) : warning 203: symbol is never used: "contractprice"
C:\Users\Admin\Desktop\Server Uploads\vx-rp.pwn(4047) : warning 204: symbol is assigned a value that is never used: "contractreason"
C:\Users\Admin\Desktop\Server Uploads\vx-rp.pwn(4046) : warning 204: symbol is assigned a value that is never used: "contracted"
C:\Users\Admin\Desktop\Server Uploads\vx-rp.pwn(4046 -- 4049) : error 036: empty statement
C:\Users\Admin\Desktop\Server Uploads\vx-rp.pwn(4046 -- 4049) : fatal error 107: too many error messages on one line
I've marked the error messages with a // ERROR, I've been trying to fix this for hours.
Reply
#2

i think u should close this ? idk
pawn Код:
contractreason,
make it
pawn Код:
contractreason;
i think but idk try it.
Reply
#3

oh come on, that are really basic stuff your trying to fix... You should first go down to basics before editing a code. I strongly suggest, that you begin to look up for some tutorials...
Reply
#4

Quote:
Originally Posted by Blunt P
Посмотреть сообщение
oh come on, that are really basic stuff your trying to fix... You should first go down to basics before editing a code. I strongly suggest, that you begin to look up for some tutorials...
Could you at least ATTEMPT to help?
Reply
#5

I haven't tested the code as i am on low internet

But try this it may work -
pawn Код:
CMD:contract ( playerid , params[] )
{
    if(playerVariables[playerid][pAdminDuty] == 1) return SendClientMessage(playerid, COLOR_RED, "You can not contract somebody while on administrator duty.");
    new Contract , CPrice , CReason[128];
    if ( sscanf ( params , "uis[128]" , Contract , CPrice , CReason ) ) return SendClientMessage ( playerid , -1 , "Usage: /contract [ID] [Price] [Reason]" ) ;
    if ( !IsPlayerConnected ( Contract ) ) return SendClientMessage ( playerid , -1 , "Invalid ID" ) ;
    if ( Contract == playerid ) return SendClientMessage ( playerid , -1 , "You cannot contract yourself" ) ;
    else
    {
    playerVariables[contracted][pContracted] = 1;
    new str[128];
    new str2[128];
    new CName[MAX_PLAYER_NAME] , DName[MAX_PLAYER_NAME];
    GetPlayerName ( Contract , CName , MAX_PLAYER_NAME ) ;
    GetPlayerName ( playerid , DName , MAX_PLAYER_NAME ) ;
    format ( str , 128 , "You have contracted %s for %i . Reason : %s" , CName , CPrice , CReason ) ;
    SendClientMessage ( playerid , -1 , str ) ;
    format ( str2 , 128 , "Somebody has requested a contract on %s for %i . Reason : %s ((If the reason isn't valid, ignore the contract.))" , DName , CPrice , CReason ) ;
    SendClientMessage ( Contract , -1 , str2 ) ;
    }
    return 1;
}
I have excluded this as i dont know the exact function of it
pawn Код:
if(playerVariables[playerid][pGroup] == 10);
Reply
#6

What you excluded was to see if you were a hitman, and then you'd recieve the message.
Reply
#7

Now this may work -
pawn Код:
CMD:contract ( playerid , params[] )
{
    if(playerVariables[playerid][pAdminDuty] == 1) return SendClientMessage(playerid, COLOR_RED, "You can not contract somebody while on administrator duty.");
    new Contract , CPrice , CReason[128];
    if ( sscanf ( params , "uis[128]" , Contract , CPrice , CReason ) ) return SendClientMessage ( playerid , -1 , "Usage: /contract [ID] [Price] [Reason]" ) ;
    if ( !IsPlayerConnected ( Contract ) ) return SendClientMessage ( playerid , -1 , "Invalid ID" ) ;
    if ( Contract == playerid ) return SendClientMessage ( playerid , -1 , "You cannot contract yourself" ) ;
    if ( !playerVariables[playerid][pGroup] == 10 ) return SendClientMessage ( playerid , COLOR_RED , "The player your trying to hire is not a hitman." ) ;
    else
    {
    playerVariables[contracted][pContracted] = 1;
    new str[128];
    new str2[128];
    new CName[MAX_PLAYER_NAME] , DName[MAX_PLAYER_NAME];
    GetPlayerName ( Contract , CName , MAX_PLAYER_NAME ) ;
    GetPlayerName ( playerid , DName , MAX_PLAYER_NAME ) ;
    format ( str , 128 , "You have contracted %s for %i . Reason : %s" , CName , CPrice , CReason ) ;
    SendClientMessage ( playerid , -1 , str ) ;
    format ( str2 , 128 , "Somebody has requested a contract on %s for %i . Reason : %s ((If the reason isn't valid, ignore the contract.))" , DName , CPrice , CReason ) ;
    SendClientMessage ( Contract , -1 , str2 ) ;
    }
    return 1;
}
Warning : The code i am giving you are not tested as i am out from my home and currently on low internet so cant test it. But may work properly.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)