SA-MP Forums Archive
Wrong with this code? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Wrong with this code? (/showthread.php?tid=179633)



Wrong with this code? - FrankC - 27.09.2010

whats wrong with this code ive tryed almost everything with "new String[128];". Code:

Код:
25597           if(TransportDuty[playerid] > 0)
25598			{
25599			    if(TransportDuty[playerid] == 1)
25600			    {
25601			        TaxiDrivers -= 1;
25602			    }
25603			    else if(TransportDuty[playerid] == 2)
25604			    {
25605			        BusDrivers -= 1;
25606			    }
25607			    TransportDuty[playerid] = 0;
25608				new String[128];
25609				format(string, sizeof(string), "* You are now Off Duty and earned $%d.", TransportMoney[playerid]);
25610				SendClientMessage(playerid, COLOR_WHITE, string);
25611				SafeGivePlayerMoney(playerid, TransportMoney[playerid]);
25612				/*ConsumingMoney[playerid] = 1;*/
25613				TransportValue[playerid] = 0;
25614				TransportMoney[playerid] = 0;
25615				return 1;
25616			}
ERROR:

Quote:

(25609) : error 017: undefined symbol "string"
(25609) : error 017: undefined symbol "string"
(25609) : error 029: invalid expression, assumed zero
(25609) : fatal error 107: too many error messages on one line




Re: Wrong with this code? - mmrk - 27.09.2010

change String[128]; to string[128];


Re: Wrong with this code? - smeti - 27.09.2010

Quote:
Originally Posted by FrankC
Посмотреть сообщение
whats wrong with this code ive tryed almost everything with "new String[128];". Code:

Код:
25608				new String[128];
25609				format(string, sizeof(string), "* You are now Off Duty and earned $%d.", TransportMoney[playerid]);
replace S whit: s



Re: Wrong with this code? - bigcomfycouch - 27.09.2010

pawn Код:
if(TransportDuty[playerid])
{
    new
        string[128];
    if(TransportDuty[playerid] == 1) --TaxiDrivers;
    else if(TransportDuty[playerid] == 2) --BusDrivers;
    TransportDuty[playerid] = 0;
    format(string, sizeof(string), "* You are now off duty and earned $%i.", TransportMoney[playerid]);
    SendClientMessage(playerid, COLOR_WHITE, string);
    SafeGivePlayerMoney(playerid, TransportMoney[playerid]);
    /*ConsumingMoney[playerid] = 1;*/
    TransportValue[playerid] = 0;
    TransportMoney[playerid] = 0;
    return 1;
}
'String' should've been 'string'


Re: Wrong with this code? - FrankC - 27.09.2010

Quote:
Originally Posted by mmrk
Посмотреть сообщение
change String[128]; to string[128];
Quote:
Originally Posted by smeti
Посмотреть сообщение
replace S whit: s
Quote:
Originally Posted by bigcomfycouch
Посмотреть сообщение
pawn Код:
if(TransportDuty[playerid])
{
    new
        string[128];
    if(TransportDuty[playerid] == 1) --TaxiDrivers;
    else if(TransportDuty[playerid] == 2) --BusDrivers;
    TransportDuty[playerid] = 0;
    format(string, sizeof(string), "* You are now off duty and earned $%i.", TransportMoney[playerid]);
    SendClientMessage(playerid, COLOR_WHITE, string);
    SafeGivePlayerMoney(playerid, TransportMoney[playerid]);
    /*ConsumingMoney[playerid] = 1;*/
    TransportValue[playerid] = 0;
    TransportMoney[playerid] = 0;
    return 1;
}
'String' should've been 'string'
Worked thanks