SA-MP Forums Archive
System Car Personal - 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: System Car Personal (/showthread.php?tid=307264)



System Car Personal - saringan_cs - 29.12.2011

Quote:

C:\Users\Best-Life\Desktop\carownership.pwn(636) : warning 204: symbol is assigned a value that is never used: "thiscar"
C:\Users\Best-Life\Desktop\carownership.pwn(811) : warning 225: unreachable code
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase

2 Warnings.

636
Quote:

new thiscar = CreateVehicle(CarInfo[carid][cModel],CarInfo[carid][cLocationx],CarInfo[carid][cLocationy],CarInfo[carid][cLocationz]+1.0,CarInfo[carid][cAngle],CarInfo[carid][cColorOne],CarInfo[carid][cColorTwo],60000);

811
Quote:

if(CarInfo[idcar][cOwned]==1)




Re: System Car Personal - saringan_cs - 29.12.2011

help please


Re: System Car Personal - Norck - 29.12.2011

First warning is telling you that you never used a variable `thiscar`.
So you can use
pawn Код:
CreateVehicle(CarInfo[carid][cModel],CarInfo[carid][cLocationx],CarInfo[carid][cLocationy],CarInfo[carid][cLocationz]+1.0,CarInfo[carid][cAngle],CarInfo[carid][cColorOne],CarInfo[carid][cColorTwo],60000);
Instead of
pawn Код:
new thiscar = CreateVehicle(CarInfo[carid][cModel],CarInfo[carid][cLocationx],CarInfo[carid][cLocationy],CarInfo[carid][cLocationz]+1.0,CarInfo[carid][cAngle],CarInfo[carid][cColorOne],CarInfo[carid][cColorTwo],60000);
The second warning is caused by some 'return' statement that prevents execution of your code that starts from
pawn Код:
if(CarInfo[idcar][cOwned]==1)
Post here at least lines 800-810 and I will tell you more about it.


Re: System Car Personal - saringan_cs - 29.12.2011

Quote:

if(strcmp(cmd, "/v", true) == 0 || strcmp(cmd, "/vehicle", true) == 0)
{
if(IsPlayerConnected(playerid))
{
new x_nr[64];
x_nr = strtok(cmdtext, idx);
if(!strlen(x_nr))
{
SendClientMessage(playerid, COLOR_WHITE, "HINT: (/v)ehicle [name]");
SendClientMessage(playerid, COLOR_WHITE, "Available names: park, lock(1-3), color, locate(1-3), tow(1-3)");
return 1;
}
else if(strcmp(x_nr,"buy",true) == 0)
{
if(IsAnOwnableCar(idcar))
{
if(PlayerInfo[playerid][pPcarkey] == -1) { }
else if(PlayerInfo[playerid][pPcarkey2] == -1) { }
else if(PlayerInfo[playerid][pPcarkey3] == -1) { }
else { SendClientMessage(playerid, COLOR_GREY, " Ai deja 3 masini!!"); return 1; }
if(CarInfo[idcar][cOwned]==1)
{
SendClientMessage(playerid, COLOR_GREY, "Someone already owns this car");
return 1;
}
if(GetPlayerMoney(playerid) >= CarInfo[idcar][cValue])
{
if(PlayerInfo[playerid][pPcarkey] == -1) { PlayerInfo[playerid][pPcarkey] = idcar; }
else if(PlayerInfo[playerid][pPcarkey2] == -1) { PlayerInfo[playerid][pPcarkey2] = idcar; }
else if(PlayerInfo[playerid][pPcarkey3] == -1) { PlayerInfo[playerid][pPcarkey3] = idcar; }
else { return 1; }
CarInfo[idcar][cOwned] = 1;
GetPlayerName(playerid, sendername, sizeof(sendername));
strmid(CarInfo[idcar][cOwner], sendername, 0, strlen(sendername), 999);
GivePlayerMoney(playerid,-CarInfo[idcar][cValue]);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
GameTextForPlayer(playerid, "~w~Felicitari~n~Nu uita sa o parchezi cu /v park!", 5000, 3);
SendClientMessage(playerid, COLOR_GRAD2, "Felicitari ti-ai cumparat o masina noua!");
TogglePlayerControllable(playerid, 1);
OnPropUpdate(); SavePlayerData(playerid);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY, " You don't have enough cash with you ! ");
return 1;
}
}
}

look


Re: System Car Personal - Norck - 29.12.2011

Try to use
pawn Код:
if(PlayerInfo[playerid][pPcarkey] != -1 && PlayerInfo[playerid][pPcarkey2]  != -1 &&
PlayerInfo[playerid][pPcarkey3] != -1)
{
    SendClientMessage(playerid, COLOR_GREY, " Ai deja 3 masini!!");
    return 1;
}
Instead of
pawn Код:
if(PlayerInfo[playerid][pPcarkey] == -1) { }
else if(PlayerInfo[playerid][pPcarkey2] == -1) { }
else if(PlayerInfo[playerid][pPcarkey3] == -1) { }
else { SendClientMessage(playerid, COLOR_GREY, " Ai deja 3 masini!!"); return 1; }



Re: System Car Personal - saringan_cs - 29.12.2011

thanks man||!!!! +1 rep |


Re: System Car Personal - Norck - 29.12.2011

Quote:
Originally Posted by saringan_cs
Посмотреть сообщение
thanks man||!!!! +1 rep |
No problem


Re: System Car Personal - saringan_cs - 29.12.2011

how to give a rep? and i have a bug .. with cars ... how type /v buy ,i say You have already 3 cars but i dont have a car ..


Re: System Car Personal - Norck - 29.12.2011

Quote:
Originally Posted by saringan_cs
Посмотреть сообщение
how to give a rep? and i have a bug .. with cars ... how type /v buy ,i say You have already 3 cars but i dont have a car ..
And does it works fine with the old code?

You can give a reputation by clicking a gray star under the profile picture.


Re: System Car Personal - saringan_cs - 29.12.2011

yes.