Rent System problems - 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)
+--- Thread: Rent System problems (
/showthread.php?tid=571071)
Rent System problems -
Ale1234 - 15.04.2015
Код:
Код:
CMD:rentaj(playerid,params[])
{
new string[128];
if (GetPlayerMoney(playerid) < 150)//Ako igrac nema 150 $, nece moci da renta.
{
SendClientMessage(playerid, CRVENA, "Nemas dovoljno Novca!");
return 1;
}
if(Rentano[playerid] != 299)//Proverava da li vec imas rentano vozilo.
{
SendClientMessage(playerid, SIVA, "Moras prvo da vratis iznajmljeno vozilo.");
return 1;
}
for(new i=0; i<MAX_PLAYERS; i++)
{
if(Rentano<i> == GetPlayerVehicleID(playerid))//Ako je neko rentao vozilo, neces ga moci rentati
{
SendClientMessage(playerid, SIVA, "Neko je vec rentao ovo vozilo.");
return 1;
}
}
GivePlayerMoney(playerid,-150);//Oduzima igracu 150$
Rentano[playerid] = GetPlayerVehicleID(playerid);//Postavlja igracu rent vozilo(da drugi nmg rentati)
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);// Pusta neke zvuke...
format(string, sizeof(string), "~r~/unrentcar~n~~g~/lock.");//Tekst koji ce biti u GameTextu
SendClientMessage(playerid, ZUTA, "Prijatan dan!");// ispisuje poruku igracu
TogglePlayerControllable(playerid, 1);//Odmrzava igraca - Omogucava mu da se krece
GameTextForPlayer(playerid, string, 5000, 3);// Prikazuje GameText
return 1;
}</i>
Error is :
C:\Users\Ewony\Desktop\New folder\gamemodes\PCRP.pwn(785) : error 028: invalid subscript (not an array or too many subscripts): "Rentano"
C:\Users\Ewony\Desktop\New folder\gamemodes\PCRP.pwn(785) : warning 215: expression has no effect
C:\Users\Ewony\Desktop\New folder\gamemodes\PCRP.pwn(785) : error 001: expected token: ";", but found "]"
C:\Users\Ewony\Desktop\New folder\gamemodes\PCRP.pwn(785) : error 029: invalid expression, assumed zero
C:\Users\Ewony\Desktop\New folder\gamemodes\PCRP.pwn(785) : fatal error 107: too many error messages on one line
Re: Rent System problems - Emmet_ - 15.04.2015
You are incorrectly accessing the array. Change this:
pawn Код:
if(Rentano<i> == GetPlayerVehicleID(playerid))
To this:
pawn Код:
if(Rentano[i] == GetPlayerVehicleID(playerid))