Problem with - [Rent] command -
NoDi522 - 13.03.2015
Hello.
I'am still working on my rent system and now i have a problem with rent command. I have just made it and these are erros:
Errors:
PHP код:
C:\Users\Dino Covic\Desktop\SAMP Server\gamemodes\Server_Skripta.pwn(714) : error 029: invalid expression, assumed zero
C:\Users\Dino Covic\Desktop\SAMP Server\gamemodes\Server_Skripta.pwn(714) : warning 215: expression has no effect
C:\Users\Dino Covic\Desktop\SAMP Server\gamemodes\Server_Skripta.pwn(714) : error 001: expected token: ";", but found ")"
C:\Users\Dino Covic\Desktop\SAMP Server\gamemodes\Server_Skripta.pwn(714) : error 029: invalid expression, assumed zero
C:\Users\Dino Covic\Desktop\SAMP Server\gamemodes\Server_Skripta.pwn(714) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
4 Errors.
PHP код:
if(Vozilo !== Rent[0] || Rent[1] || Rent[2] || Rent[3] || Rent[4] || Rent[5] || Rent[6] || Rent[7]) return SendClientMessage(playerid,-1,"{F81414}Greska:{FFFFFF} Ne nalazite se u vozilu za rentanje");
Re: Problem with - [Rent] command -
Evocator - 13.03.2015
Код:
for (new i = 0; i != 8; i++)
{
if(Vozilo != Rent[i]) return SendClientMessage(playerid,-1,"{F81414}Greska:{FFFFFF} Ne nalazite se u vozilu za rentanje");
}
Re: Problem with - [Rent] command -
CalvinC - 13.03.2015
First off, you have to check Vozilo != for each || you use.
Second off, you should use !=, not !==
pawn Код:
if(Vozilo != Rent[0] || Vozilo != Rent[1] || Vozilo != Rent[2] // and so on
Or you could just loop through the array.
Re: Problem with - [Rent] command -
NoDi522 - 13.03.2015
Hmm. Yes thank you for that,but when I enter rentable vehicle it doesn't allow me: Error: You are not in vehicle.
Command code:
PHP код:
CMD:rent(playerid,params[])
{
new Vozilo = GetPlayerVehicleID(playerid);
for (new i = 0; i != 8; i++)
if(Vozilo != Rent[i]) return SendClientMessage(playerid,-1,"{F81414}Greska:{FFFFFF} Ne nalazite se u vozilu za rentanje");
if(Rentano[playerid] == 0)
if(ARentano[playerid] == 1) return SendClientMessage(playerid,-1,"{F81414}Greska:{FFFFFF} Vec ste rentali vozilo");
{
if(GetPlayerMoney(playerid) < 500) return SendClientMessage(playerid,-1,"{F81414}Greska:{FFFFFF} Nemate dovoljno novca na racunu");
{
GivePlayerMoney(playerid,-500);
SendClientMessage(playerid,-1,"{00C0FF}WG:{FFFFFF} Uspjesno ste rentali vozilo");
Rentano[playerid] = 1;
ARentano[playerid] = 1;
}
}
return 1;
}
Re: Problem with - [Rent] command -
Evocator - 13.03.2015
If you could translate those, id better help you more. Anyways try this:
Код:
CMD:rent(playerid,params[])
{
new
Vozilo = GetPlayerVehicleID(playerid)
;
for (new i = 0; i != 8; i++)
{
if(Vozilo != Rent[i]) return SendClientMessage(playerid,-1,"{F81414}Greska:{FFFFFF} Ne nalazite se u vozilu za rentanje");
}
if(Rentano[playerid] == 0)
{
if(ARentano[playerid] == 0)
{
if(GetPlayerMoney(playerid) >= 500)
{
GivePlayerMoney(playerid,-500);
SendClientMessage(playerid,-1,"{00C0FF}WG:{FFFFFF} Uspjesno ste rentali vozilo");
Rentano[playerid] = 1;
ARentano[playerid] = 1;
}
else SendClientMessage(playerid,-1,"{F81414}Greska:{FFFFFF} Nemate dovoljno novca na racunu");
}
else SendClientMessage(playerid,-1,"{F81414}Greska:{FFFFFF} Vec ste rentali vozilo");
}
return 1;
}
Re: Problem with - [Rent] command -
NoDi522 - 13.03.2015
PHP код:
CMD:rent(playerid,params[])
{
new
Vozilo = GetPlayerVehicleID(playerid)
;
for (new i = 0; i != 8; i++)
{
if(Vozilo != Rent[i]) return SendClientMessage(playerid,-1,"{F81414}Greska:{FFFFFF} You are not in "rentable" vehicle.");
}
if(Rentano[playerid] == 0)
{
if(ARentano[playerid] != 0) // i changed this. You put it as 0. I set it to 1 because i want to check if is he already rented it.
{
if(GetPlayerMoney(playerid) >= 500)
{
GivePlayerMoney(playerid,-500);
SendClientMessage(playerid,-1,"{00C0FF}WG:{FFFFFF} You rented vehicle succesfully.");
Rentano[playerid] = 1;
ARentano[playerid] = 1;
}
else SendClientMessage(playerid,-1,"{F81414}Greska:{FFFFFF} You don't have enough money.");
}
else SendClientMessage(playerid,-1,"{F81414}Greska:{FFFFFF} You have already rented vehicle.");
}
return 1;
}
Ok so its giving me the same error. I'am in rentable vehicle and it doesn't allow. And here is your translate,but please use my language in SMDs
Re: Problem with - [Rent] command -
Evocator - 13.03.2015
I'm using an else code, so
that is wrong:
Код:
if(ARentano[playerid] != 0)
Here you are checking if the player has the ARentano var to
not 0 and hence anything else, including 1. So basically if you do not have a vehicle, and the var ARentano is set to 0 the code will not run and will send the else message.
This is correct:
Код:
if(ARentano[playerid] == 0)
You are checking if the ARentano var is to 0, hence no vehicle and thus processing the code and buying a vehicle.
Re: Problem with - [Rent] command -
NoDi522 - 14.03.2015
PHP код:
CMD:rent(playerid,params[])
{
new Vozilo = GetPlayerVehicleID(playerid);
{
if(Vozilo != Rent[0] || Vozilo != Rent[1] || Vozilo != Rent[2] || Vozilo != Rent[3] || Vozilo != Rent[4] || Vozilo != Rent[5] || Vozilo != Rent[6] || Vozilo != Rent[7]) return SendClientMessage(playerid,-1,"{F81414}Greska:{FFFFFF} Ne nalazite se u vozilu za rentanje");
}
if(Rentano[playerid] == 0)
{
if(ARentano[playerid] == 0)
{
if(GetPlayerMoney(playerid) >= 500)
{
GivePlayerMoney(playerid,-500);
SendClientMessage(playerid,-1,"{00C0FF}WG:{FFFFFF} Uspjesno ste rentali vozilo");
Rentano[playerid] = 1;
ARentano[playerid] = 1;
}
else SendClientMessage(playerid,-1,"{F81414}Greska:{FFFFFF} Nemate dovoljno novca na racunu");
}
else SendClientMessage(playerid,-1,"{F81414}Greska:{FFFFFF} Vec ste rentali vozilo");
}
return 1;
}
I really don't know what is the problem. So i tried the function like this and again says "You are not in rentable vehicle". More help?