if(strcmp(GetName(playerid), dini_Get(string, "Owner"), true)) { if(CarInfo[CarID][Engine] == 0) { //Start engine CarInfo[CarID][Engine] = 1;//This should happen if the name of the player = the owner of the car. TogglePlayerControllable(playerid, 1);//This should happen if the name of the player = the owner of the car. } } else { SendClientMessage(playerid, Red, "You have no keys for this car.");//And this should happen if the name of the player is not the owner. }
if(!strcmp(GetName(playerid), dini_Get(string, "Owner"), true))
{
...
}
pawn Код:
|
if(!strcmp(GetName(playerid)&&dini_Get(string, "Owner"), true)==1)
{
...
}
pawn Код:
|
Shouldn't it be like this:
pawn Код:
Cheers. |
if(!strcmp(GetName(playerid), dini_Get(string, "Owner"), true))
{
...
}
if(!strcmp(GetName(playerid), dini_Get(string, "Owner"), true)) { if(CarInfo[CarID][Engine] == 0) { //Start engine CarInfo[CarID][Engine] = 1;//This should happen if the name of the player = the owner of the car. TogglePlayerControllable(playerid, 1);//This should happen if the name of the player = the owner of the car. } } else { SendClientMessage(playerid, Red, "You have no keys for this car.");//And this should happen if the name of the player is not the owner. }
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) { if(newkeys == KEY_WALK) { if(IsPlayerInAnyVehicle(playerid)) { if(GetPlayerVehicleSeat(playerid) == 0) { new CarID = GetPlayerVehicleID(playerid); new string[100]; format(string, sizeof(string),"/Cars/Car(%d).Cfg", CarID); if(!strcmp(GetName(playerid), dini_Get(string, "Owner"), true)) { if(CarInfo[CarID][Engine] == 0) { CarInfo[CarID][Engine] = 1; TogglePlayerControllable(playerid, 1); } } else { SendClientMessage(playerid, Red, "You have no keys for this car."); } } } return 1; } return 1; }
printf("%s", GetName(playerid));
printf("%s", dini_Get(string, "Owner"));
if(!strcmp(GetName(playerid), dini_Get(string, "Owner"), true))
{
if(CarInfo[CarID][Engine] == 0)
{
CarInfo[CarID][Engine] = 1;
TogglePlayerControllable(playerid, 1);
}
}
else
{
SendClientMessage(playerid, Red, "You have no keys for this car.");
}